I have a test project here with the modules
appmylibrary
mylibrary obviously is a library project, and the app module uses that module.
I want to add the Firebase remote config to the library module (adding it to the app module works all fine).
I added to the top-level build.gradle:
classpath 'com.google.gms:google-services:3.1.0'
and of course the actual dependency on the library module:
compile 'com.google.firebase:firebase-config:11.4.0'
Now I've tried two variations:
1. When I apply the google services plugin on the mylibrary module with
apply plugin: 'com.google.gms.google-services'
the project doesn't compile with the following error:
Error:(34, 0) Could not get unknown property 'LibraryVariants' for object of type com.android.build.gradle.LibraryExtension
2. When I apply the plugin to the app module, the project compiles, but at runtime I get the error:
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.common.internal.safeparcel.AbstractSafeParcelable" on path: DexPathList[[zip file "/data/app/com.example.firebasethrowaway-2/base.apk", zip file (...)
and
Rejecting re-init on previously-failed class java.lang.Class: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/common/internal/safeparcel/AbstractSafeParcelable;
at com.google.android.gms.measurement.internal.zzx com.google.android.gms.measurement.internal.zzx.zzbd(android.content.Context) ((null):-1)
Any idea how I can add the firebase dependency via my library module?