Skip to content
This repository has been 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

Open
jkasten2 opened this issue Nov 6, 2018 · 0 comments
Labels

Comments

@jkasten2
Copy link
Member

jkasten2 commented Nov 6, 2018

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.

@jkasten2 jkasten2 added the Bug label Nov 6, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

1 participant