0

After migrating to android gradle plugin "3.0.0-beta7" i added my application module. Since 3.0.0 buildTypes should be the same in MAIN MODULE and dependency MODULE. I did dat but i'm still getting these errors:

"Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve project :library"

This error is repeated for all variants: debug, tst and release. I already read the whole migrate to 3.0 tutorial by android. Also tried adding matchingFallbacks even though buildTypes are exactly the same but keep receiving these errors. Seems like there is a bug in the plugin or something..

build.gradle app module:

 signingConfigs {
    tstRelease {
        keyAlias keystoreProperties['keyAlias']
        keyPassword keystoreProperties['keyPassword']
        storeFile file(keystoreProperties['storeFile'])
        storePassword keystoreProperties['storePassword']
    }
}
    buildTypes {

        debug {
            matchingFallbacks 'debug'
            applicationIdSuffix ".debug"
            testCoverageEnabled !project.hasProperty('android.injected.invoked.from.ide')
            renderscriptDebuggable true
        }
        tst {

            debuggable true
            signingConfig signingConfigs.tstRelease
        }
        release {
            debuggable false
            minifyEnabled true
            //TODO: add more proguard configs here for different libs
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            signingConfig signingConfigs.tstRelease
        }
        flavorDimensions "default"

    }

    dataBinding {
        enabled = true
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    sourceSets {
        androidTest.java.srcDirs += "src/test-common/java"
        test.java.srcDirs += "src/test-common/java"
    }
    lintOptions {
        lintConfig rootProject.file('lint.xml')
    }
}

How i invoke my `library:

implementation project(path: ":library" )

build.gradle :library module:

`

compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}

buildTypes {
    debug {

    }
    tst {

    }
    release {
        minifyEnabled true
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        signingConfig signingConfigs.prodConfig
        buildConfigField "String", "BASE_URL", ""
    }

}

play {
    jsonFile = file(serviceAccountName)
    track = 'alpha'
}

flatc {
    genMutable = true
}

:library module - dependencies /// FCM; Crash Reporting; Notification; Remote config dependencies {

    implementation "com.google.dagger:dagger:${rootProject.ext.daggerVersion}"
    annotationProcessor "com.google.dagger:dagger-compiler:${rootProject.ext.daggerVersion}"

    implementation "com.jakewharton.timber:timber:${rootProject.ext.timberVersion}"
    implementation "com.google.android.agera:agera:${rootProject.ext.ageraVersion}"
    implementation "com.google.android.agera:content:${rootProject.ext.ageraVersion}"
    implementation "com.google.android.agera:database:${rootProject.ext.ageraVersion}"
    implementation "com.google.android.agera:net:${rootProject.ext.ageraVersion}"
    implementation "com.google.android.agera:rvadapter:${rootProject.ext.ageraVersion}"
    implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
    implementation "com.android.support:cardview-v7:${rootProject.ext.supportLibVersion}"
    implementation "com.android.support:support-v4:${rootProject.ext.supportLibVersion}"
    implementation "com.android.support:design:${rootProject.ext.supportLibVersion}"
    implementation "com.android.support:percent:${rootProject.ext.supportLibVersion}"
    implementation "com.android.support:preference-v14:${rootProject.ext.supportLibVersion}"

    implementation "com.google.code.gson:gson:${rootProject.ext.gsonVersion}"
    implementation "com.squareup.okhttp3:okhttp:${rootProject.ext.okHttpVersion}"

    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })

    api project(":androidtestlib")


    implementation "com.google.firebase:firebase-core:${rootProject.ext.firebaseVersion}"
    implementation "com.google.firebase:firebase-messaging:${rootProject.ext.firebaseVersion}"
    implementation "com.google.firebase:firebase-config:${rootProject.ext.firebaseVersion}"
    implementation "com.google.firebase:firebase-crash:${rootProject.ext.firebaseVersion}"
    implementation "com.google.firebase:firebase-perf:${rootProject.ext.firebaseVersion}"

    implementation "com.firebase:firebase-jobdispatcher:${rootProject.ext.jobDispatcherVersion}"

    testCompile 'junit:junit:4.12'
    testCompile 'org.mockito:mockito-core:2.8.47'
    androidTestCompile 'org.mockito:mockito-android:2.8.47'


    implementation 'com.android.support.constraint:constraint-layout:1.0.2'

    implementation 'com.newrelic.agent.android:android-agent:5.12.3'
}

apply plugin: 'com.google.gms.google-services'

EDIT:

adding

api project(path: ":library", configuration: 'default' )

or

implementation project(path: ":library", configuration: 'default' )

Results in the project compiling but when trying to use classes of module the following popup appears.

enter image description here

Here i can choose to add dependency to project. Which results in Android studio adding the dependency the <3 android gradle plugin way. Which gives me the same errors as stated on top of the question.

Sjaak Rusma
  • 1,267
  • 3
  • 17
  • 34

0 Answers0