Skip to content
This repository was archived by the owner on Oct 31, 2022. It is now read-only.
This repository was archived by the owner on Oct 31, 2022. It is now read-only.

Android Studio Sync Failure with apply order when sub project is present #77

@jkasten2

Description

@jkasten2

Issue

When com.onesignal.androidsdk.onesignal-gradle-plugin is applied before com.android.application and there is a sub Android library project sync gradle fails in Android Studio but all other ./gradlew build commands work just fine.

This is a follow up to issue #76 which a work around was found by changing the apply order. However this shouldn't be necessary for an app developer to change this.

Project Setup

build.gradle

buildscript {
    repositories {
        google()
        jcenter()
        maven { url 'https://plugins.gradle.org/m2/'}
    }
    dependencies {
        classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:0.12.1'
        classpath 'com.android.tools.build:gradle:3.2.1'
        classpath 'com.google.gms:google-services:4.1.0'
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

app/build.gradle

apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
apply plugin: 'com.android.application'

android {
    compileSdkVersion 27
    buildToolsVersion '28.0.3'
    defaultConfig {
        applicationId "com.onesignal.example"
        minSdkVersion 16
        targetSdkVersion 27
        versionCode 5
        versionName "1.2.1"
        manifestPlaceholders = [
            onesignal_app_id: 'ONESIGNAL_APP_ID',
            // Project number pulled from dashboard, local value is ignored.
            onesignal_google_project_number: 'REMOTE'
        ]
    }
    buildTypes {
        debug {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile project(':common')
}

common/build.gradle

apply plugin: 'com.android.library'

android {
    compileSdkVersion 27
    buildToolsVersion '28.0.3'
    defaultConfig {
        minSdkVersion 16
        targetSdkVersion 27
        versionCode 1
        versionName "1.0.0"
    }
    buildTypes {
        debug {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
}

Full Error

"Resolving this BuildableArtifact can only done during task execution."

Other Things Tried

Upgrading to AGP 3.3.0-beta02 - no effect
Downgrading this plugin to 0.11.3 results in the following error instead;

Cannot change strategy of configuration ':appr:debugRuntimeClasspath' after it has been resolved.

What works

The following runs fine without issues.

./gradlew assembleDebug works
./gradlew :app:dependencies

Dependency Tree

Does not apply, dependencies them selves are resolved correctly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions