1
votes

My app needs to integrate google play services and firebase;so,I have downloaded the offical demo ,complie google play services and firebase sdk, google play services and firebase sdk have been updated to v9.2.1,the demo works well on android 5.0+,but crash on android 4.4.4.

Click here to download the demo!

Here is my build.gradle:

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.2.1'
compile 'com.android.support:support-v4:23.2.1'

 compile 'com.google.firebase:firebase-core:9.2.1'
compile 'com.google.android.gms:play-services:9.2.1'
}

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

And here is the crash log:

07-19 14:34:29.790 25938-25938/com.google.firebase.quickstart.analytics E/FirebaseCrash: Failed to initialize crash reporting com.google.firebase.crash.internal.zzg$zza:

com.google.android.gms.internal.zzsj$zza: No acceptable module found. Local version is 0 and remote version is 0. at com.google.firebase.crash.internal.zzg.zzbq(Unknown Source) at com.google.firebase.crash.FirebaseCrash.(Unknown Source) at com.google.firebase.crash.FirebaseCrash.getInstance(Unknown Source) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:515) at com.google.firebase.FirebaseApp.zza(Unknown Source) at com.google.firebase.FirebaseApp.initializeApp(Unknown Source) at com.google.firebase.FirebaseApp.initializeApp(Unknown Source) at com.google.firebase.FirebaseApp.zzeh(Unknown Source) at com.google.firebase.provider.FirebaseInitProvider.onCreate(Unknown Source) at android.content.ContentProvider.attachInfo(ContentProvider.java:1591) at android.content.ContentProvider.attachInfo(ContentProvider.java:1562) at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source) at android.app.ActivityThread.installProvider(ActivityThread.java:5038) at android.app.ActivityThread.installContentProviders(ActivityThread.java:4632) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4566) at android.app.ActivityThread.access$1500(ActivityThread.java:145) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1276) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:145) at android.app.ActivityThread.main(ActivityThread.java:5266) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:515) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:826) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:642) at dalvik.system.NativeStart.main(Native Method) Caused by: com.google.android.gms.internal.zzsj$zza: No acceptable module found. Local version is 0 and remote version is 0. at com.google.android.gms.internal.zzsj.zza(Unknown Source) at com.google.firebase.crash.internal.zzg.zzbq(Unknown Source)  at com.google.firebase.crash.FirebaseCrash.(Unknown Source)  at com.google.firebase.crash.FirebaseCrash.getInstance(Unknown Source)  at java.lang.reflect.Method.invokeNative(Native Method)  at java.lang.reflect.Method.invoke(Method.java:515)  at com.google.firebase.FirebaseApp.zza(Unknown Source)  at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)  at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)  at com.google.firebase.FirebaseApp.zzeh(Unknown Source)  at com.google.firebase.provider.FirebaseInitProvider.onCreate(Unknown Source)  at android.content.ContentProvider.attachInfo(ContentProvider.java:1591)  at android.content.ContentProvider.attachInfo(ContentProvider.java:1562)  at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source)  at android.app.ActivityThread.installProvider(ActivityThread.java:5038)  at android.app.ActivityThread.installContentProviders(ActivityThread.java:4632)  at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4566)  at android.app.ActivityThread.access$1500(ActivityThread.java:145)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1276)  at android.os.Handler.dispatchMessage(Handler.java:102)  at android.os.Looper.loop(Looper.java:145)  at android.app.ActivityThread.main(ActivityThread.java:5266)  at java.lang.reflect.Method.invokeNative(Native Method)  at java.lang.reflect.Method.invoke(Method.java:515)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:826)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:642)  at dalvik.system.NativeStart.main(Native Method)

Anyone can help me?

2
please, share the link to the demo project you used or share some source codeddb
please use this instead of play service com.google.android.gms:play-services-maps:9.2.1 . let me know the resultDKV
Hi V V, thx for your answer,but it's not right to my requirementTjl

2 Answers

0
votes

As a first step, you should identify the specific Play Service APIs your app needs and include only those instead of com.google.android.gms:play-services. Listing play-services as a dependency pulls in all of Play Services and causes the 64K limit on method references to be exceeded. This creates problems when running on pre-Lollipop devices.

The complete list of Play Services APIs is provided here and the Firebase APIs are listed here. Find the ones you need and list them in your dependencies instead of com.google.android.gms:play-services.

To get an understanding of all the libraries that are pulled in when you specify play-services as a dependency, you can look at this gist or open the Android Studio tool window for Gradle and run the androidDependencies task under :app\Tasks\android.

0
votes

Firebase is now included in the google-play-services - see https://developers.google.com/android/guides/releases#june_2016_-_v92 . But somehow the play-services on API 19(aka Android 4.4) do not contain usable firebase-files. So what you have do do is, compile only the used APIs from the play-services and exclude the Firebase from them.

So remove line compile 'com.google.android.gms:play-services:9.2.1' and replace with something like compile 'com.google.android.gms:play-services-NAME_OF_USED_API:9.2.1'

Alternative you could use an older Version of the google-play-services that doesn't contain Firebase.