Gradle Plugin 3.0.1 AAR transitive dependency missing

Viewed 570

I'm looking to use Firebase Analytics within a library (AAR). Using Android Gradle Plugin 3.0.1, and Gradle 4.1. I've included the firebase dependency as api, however, when packaged into the AAR the dependency is missing, and it crashes at runtime in the consuming application (it is not a 'module' within that application). This crash is due to a java.lang.ClassNotFoundException: Didn't find class "com.google.firebase.analytics.FirebaseAnalytics" exception.

Library Module: build.gradle

dependencies {
    implementation 'com.squareup.retrofit2:retrofit:2.3.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
    implementation 'com.squareup.okhttp3:okhttp:3.9.0'
    implementation "com.android.support:support-annotations:$supportLibraryVersion"
    implementation "com.android.support:appcompat-v7:$supportLibraryVersion"
    api 'com.google.firebase:firebase-core:11.6.0'
}

I can get around this by including the implementation "<firebase>" line in the consuming application, however, I was of the understanding that api would expose as a transitive dependency to the consumer.

I don't want to force the consumer application to implement Firebase, and it's functional when not setting up the google-play-services.json file, plugin, and app/build.gradle changes (provided I have the consumer's implementation line).

Using either implementation <firebase> or api <firebase> within the Library Module, within the same project, the application including it as per: implementation project(':mylib') it operates okay, it is solely when using the AAR that the issue occurs.

Additional note, the Module creating the AAR contains native code.

0 Answers
Related