Facebook accout kit Firebase API initialization failure - android

After implementing Facebook Account Kit and run project it shows Firebase API initialization failure as
FirebaseApp: Firebase API initialization failure.
java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
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.initializeApp(Unknown Source)
at com.google.firebase.provider.FirebaseInitProvider.onCreate(Unknown Source)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1758)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1733)
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source)
at android.app.ActivityThread.installProvider(ActivityThread.java:5257)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4808)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4748)
at android.app.ActivityThread.access$1700(ActivityThread.java:153)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1436)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:5529)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:739)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:629)
And also getting Null Pointer Exception from AccountKitController as
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.pm.PackageManager android.content.Context.getPackageManager()' on a null object reference
at com.facebook.accountkit.internal.Initializer.initialize(Initializer.java:101)
at com.facebook.accountkit.internal.AccountKitController.initialize(AccountKitController.java:601)
at com.facebook.accountkit.internal.AccountKitInitProvider.onCreate(AccountKitInitProvider.java:31)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1758)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1733)
at android.app.ActivityThread.installProvider(ActivityThread.java:5257)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4808)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4748)
at android.app.ActivityThread.access$1700(ActivityThread.java:153)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1436)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:5529)
at java.lang.reflect.Method.invoke(Native Method)
Using Account kit gradle as
compile 'com.facebook.android:account-kit-sdk:4.27.0'
And Firebase Gradle as
compile 'com.google.firebase:firebase-messaging:11.0.4'
Note : Removing Account Kit from project its working fine i.e. there is no Firebase API initialization failure. issue. Therefore it's sure that there is conflict in firebase and Account kit SDK (:

This is caused by Facebook's SDK being packaged with a different version of the GMS library than what is packaged with Firebase's. You can do something like this to get back up and running:
compile ('com.facebook.android:account-kit-sdk:4.27.0') {
exclude group: 'com.google.android.gms', module: 'play-services-auth-api-phone'
exclude group: 'com.google.android.gms', module: 'play-services-auth'
}
compile 'com.google.android.gms:play-services-auth:11.6.0'
compile 'com.google.firebase:firebase-messaging:11.6.0'
What this does is essentially hot-swaps out the older library for the newer one packaged with Firebase. It tells Facebook to compile without the old libs and then we make sure they are added back in with newer version right after.

For NullPointerException exception it seems that, Application is not initialized first, Content Providers are initialized before it.
And in Facebook account kit SDK's code it was trying to get my application context.
Now the problem was, I did implement method getApplicationContext() in application class that is getting application shared variable but that variable was setting globally and Facebook Account Kit sdk code getting Null application context.
Solution : setting shared variable in onCreate method instead of setting globally it resolved the problem of Unable to get provider.
And For Mixing issue, Account Kit SDK use 11.0.1 version for play services gradle and in my project I am having 11.0.4 that is actually not the issue because on compile time gradle takes latest gradle but In my project I am not referring below gradle which Facebook Account Kit SDK is using.
compile 'com.google.android.gms:play-services-auth-api-phone:11.0.1'
Solution : I have added above gradle with version 11.0.4 and the mixing gradle issue has been resolved.
compile 'com.google.android.gms:play-services-auth-api-phone:11.0.4'
And as suggested by #astryk if I exclude play-services-auth-api-phone module then gradle mixing error is not showing but it is not including that module becasue in AccountKitActivity on next button click my application crashes as
Crash Report Thread:main Exception:java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/auth/api/phone/SmsRetriever;
at com.facebook.accountkit.internal.PhoneLoginController.createSmsToken(PhoneLoginController.java:250)
at com.facebook.accountkit.internal.PhoneLoginController.logIn(PhoneLoginController.java:188)
at com.facebook.accountkit.internal.LoginManager.logInWithPhoneNumber(LoginManager.java:372)
at com.facebook.accountkit.internal.AccountKitController.logInWithPhoneNumber(AccountKitController.java:631)
at com.facebook.accountkit.ui.PhoneLoginFlowManager.logInWithPhoneNumber(PhoneLoginFlowManager.java:57)
at com.facebook.accountkit.ui.ActivityPhoneHandler.onPhoneLoginComplete(ActivityPhoneHandler.java:189)
at com.facebook.accountkit.ui.AccountKitActivity$1.onReceive(AccountKitActivity.java:176)
at android.support.v4.content.LocalBroadcastManager.executePendingBroadcasts(LocalBroadcastManager.java:297)
at android.support.v4.content.LocalBroadcastManager.access$000(LocalBroadcastManager.java:46)
at android.support.v4.content.LocalBroadcastManager$1.handleMessage(LocalBroadcastManager.java:116)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:5529)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:739)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:629)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.auth.api.phone.SmsRetriever" on path: DexPathList[[zip file "/data/app/com.myapp-1/base.apk"],nativeLibraryDirectories=[/data/app/com.myappList item -1/lib/arm64, /vendor/lib64, /system/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
... 16 more
Suppressed: java.lang.ClassNotFoundException: com.google.android.gms.auth.api.phone.SmsRetriever
at java.lang.Class.classForName(Native Method)
at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
... 17 more
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available`

Related

Splash Screen is show but next screen app crashed logcat error is shown error something like this

08-17 06:27:52.494 8079-8079/? E/FirebaseApp: Firebase API initialization failure.
java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
at com.google.firebase.FirebaseApp.zza(SourceFile:739)
at com.google.firebase.FirebaseApp.zze(SourceFile:705)
at com.google.firebase.FirebaseApp.initializeApp(SourceFile:328)
at com.google.firebase.FirebaseApp.initializeApp(SourceFile:294)
at com.google.firebase.FirebaseApp.initializeApp(SourceFile:281)
at com.google.firebase.provider.FirebaseInitProvider.onCreate(SourceFile:37)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1759)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1734)
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(SourceFile:31)
at android.app.ActivityThread.installProvider(ActivityThread.java:6420)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:6012)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5951)
at android.app.ActivityThread.-wrap3(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1710)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6776)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1518)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1408)
Caused by: java.lang.NoSuchMethodError: No virtual method zzbqp()Ljava/lang/String; in class Lcom/google/firebase/FirebaseApp; or its super classes (declaration of 'com.google.firebase.FirebaseApp' appears in /data/app/com.setting.noshairamjad7.wallpaper-1/base.apk)
at com.google.firebase.auth.FirebaseAuth.zzb(Unknown Source)
at com.google.firebase.auth.FirebaseAuth.getInstance(Unknown Source)
at java.lang.reflect.Method.invoke(Native Method) 
at com.google.firebase.FirebaseApp.zza(SourceFile:739) 
at com.google.firebase.FirebaseApp.zze(SourceFile:705) 
at com.google.firebase.FirebaseApp.initializeApp(SourceFile:328) 
at com.google.firebase.FirebaseApp.initializeApp(SourceFile:294) 
at com.google.firebase.FirebaseApp.initializeApp(SourceFile:281) 
at com.google.firebase.provider.FirebaseInitProvider.onCreate(SourceFile:37) 
at android.content.ContentProvider.attachInfo(ContentProvider.java:1759) 
at android.content.ContentProvider.attachInfo(ContentProvider.java:1734) 
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(SourceFile:31) 
at android.app.ActivityThread.installProvider(ActivityThread.java:6420) 
at android.app.ActivityThread.installContentProviders(ActivityThread.java:6012) 
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5951) 
at android.app.ActivityThread.-wrap3(ActivityThread.java) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1710) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:154) 
at android.app.ActivityThread.main(ActivityThread.java:6776) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1518) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1408) 
08-17 06:27:53.881 8079-8079/com.setting.noshairamjad7.wallpaper E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.setting.noshairamjad7.wallpaper, PID: 8079
here is gradle it's my first post so sorry if not properlyposted
Try this:
1.You should never include this dependency! It brings in all of the play-services-{x} libraries into your app at once. Just remove this line
compile 'com.google.android.gms:play-services:9.0.0'
Could you try updating dependencies to a later version? That means change all the 25.3.1 dependencies to 26.0.1 or 27.0.0 and all the 9.0.0 dependencies to 11.4.2 or 11.6.0.
it helps you
A simple solution is that use Fireabase Assistant to initialize the Firebase in your application
First remove all firebase dependency and apply plugin: 'com.google.gms.google-services' from your app gradle ( in Android Studio 2.3.3) follow this step
Tools > Firebase
(On right tab) Assistant > Authentication
Caused by: java.lang.NoSuchMethodError: No virtual method zzbqp()Ljava/lang/String; in class Lcom/google/firebase/FirebaseApp; or its super classes (declaration of 'com.google.firebase.FirebaseApp' appears in /data/app/com.setting.noshairamjad7.wallpaper-1/base.apk)
at com.google.firebase.auth.FirebaseAuth.zzb(Unknown Source)
A missing ProGuard rule ?
https://firebase.google.com/docs/database/android/start/

Runtime Crash with Proguard enabled Room Persistence Library

I have been facing following crash with Room stable version when proguard is enabled
FATAL EXCEPTION: main
Process: <mypackage>.debug, PID: 27841
java.lang.RuntimeException: Unable to create application <mypackage>.DebugBaseApplication: java.lang.RuntimeException: cannot find implementation for <mypackage>.database.c. c_Impl does not exist
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5015)
at android.app.ActivityThread.-wrap1(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1573)
at android.os.Handler.dispatchMessage(Handler.java:111)
at android.os.Looper.loop(Looper.java:207)
at android.app.ActivityThread.main(ActivityThread.java:5811)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:681)
Caused by: java.lang.RuntimeException: cannot find implementation for <mypackage>.database.c. c_Impl does not exist
at android.a.c.b.d.a(Unknown Source)
at android.a.c.b.e$a.b(Unknown Source)
at <mypackage>.database.c.getFuelDatabase(Unknown Source)
at <mypackage>.database.b.init(Unknown Source)
at <mypackage>.c.onCreate(Unknown Source)
at <mypackage>.DebugBaseApplication.onCreate(Unknown Source)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1041)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5012)
at android.app.ActivityThread.-wrap1(ActivityThread.java) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1573) 
at android.os.Handler.dispatchMessage(Handler.java:111) 
at android.os.Looper.loop(Looper.java:207) 
at android.app.ActivityThread.main(ActivityThread.java:5811) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:681)
Here is my proguard configuration for room
## Room
-dontwarn android.arch.util.paging.CountedDataSource
-dontwarn android.arch.persistence.room.paging.LimitOffsetDataSource
Here are how dependencies are being declared in build.gradle
// room for local cache
implementation "android.arch.persistence.room:runtime:1.0.0"
annotationProcessor "android.arch.persistence.room:compiler:1.0.0"
implementation "android.arch.persistence.room:rxjava2:1.0.0"
I have gone through many stackoverflow posts regarding this. Like
Room Persistence Library run time exception when calling Rooms inMemoryBuilder method
and Room cannot find implementation but thing is I am not using Kotlin and everything seems correctly configured to me. I am not sure whats the problem here please suggest.

Unity 2017 Facebook Init error AndroidJavaException: java.lang.ClassNotFoundException: com.facebook.unity.FB

Getting this error when calling FB.Init in the Facebook-provided example scenes:
AndroidJavaException: java.lang.ClassNotFoundException: com.facebook.unity.FB
java.lang.ClassNotFoundException: com.facebook.unity.FB
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:324)
at java.lang.Class.forName(Class.java:285)
at com.unity3d.player.UnityPlayer.nativeRender(Native Method)
at com.unity3d.player.UnityPlayer.c(Unknown Source)
at com.unity3d.player.UnityPlayer$c$1.handleMessage(Unknown Source)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:148)
at com.unity3d.player.UnityPlayer$c.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.facebook.unity.FB" on path: DexPathList[[zip file "/data/app/com.redacted.redacted-1/base.apk"],nativeLibraryDirectories=[/data/app/com.redacted.redacted-1/lib/arm, /data/app/com.redacted.redacted-1/base.apk!/lib/armeabi-v7a, /vendor/lib, /system/lib]]
Using Facebook Unity SDK 7.10.0 and Unity 2017.1.0f3, building using Gradle. I've tried deleting and re-adding the SDK like another similar post said worked for them but I'm still getting the issue. All Facebook settings should be correct because it works great on iOS.
Facebook SDK and Firebase Authentication SDK are the only things in the project.
Any help is appreciated!
EDIT - It appears to be a compatability issue with Unity 2017.1.0f3. I've rolled back to Unity 5.6.2f1 and it functions perfectly.
Got it working in Unity 2017 by double checking all my settings and switching from Gradle back to internal build.

Android FCM + Nearby conflict

I need both Firebase Cloud Messaging and Nearby support in my app.
The latest allowed Nearby version is 9.0.0. So, I have to use following dependencies:
//Firebase
compile ‘com.google.firebase:firebase-core:9.0.0'
compile ‘com.google.firebase:firebase-messaging:9.0.0'
//Nearby
compile ‘com.google.android.gms:play-services-nearby::9.0.0’
It compiles successfully but when I try to get Firebase instance app crashes with IllegalAccessError:
java.lang.IllegalStateException: Fatal Exception thrown on Scheduler.Worker thread.
at rx.android.schedulers.LooperScheduler$ScheduledAction.run(LooperScheduler.java:114)
at android.os.Handler.handleCallback(Handler.java:746)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5443)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:728)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
Caused by: java.lang.IllegalAccessError: Method 'void android.support.v4.content.ContextCompat.<init>()' is inaccessible to class 'com.google.firebase.iid.zzg' (declaration of 'com.google.firebase.iid.zzg' appears in /data/app/com.obolus.poc.customer-1/base.apk)
at com.google.firebase.iid.zzg.zzeC(Unknown Source)
at com.google.firebase.iid.zzg.<init>(Unknown Source)
at com.google.firebase.iid.zzg.<init>(Unknown Source)
at com.google.firebase.iid.zzd.zzb(Unknown Source)
at com.google.firebase.iid.FirebaseInstanceId.getInstance(Unknown Source)
Using of different versions for these components causes compile error. Firebase 10.0.1 without Nearby works fine but I need both.
How can I solve this issue?
Thanks.
Solution
Perhaps it's a bug but for now to ensure that play-services plugin will check available versions correctly place line
apply plugin: 'com.google.gms.google-services'
at the bottom of your build.gradle file (below the dependencies block).
Check out https://firebase.google.com/docs/android/setup#add_the_sdk
I think you are wrong the latest nearby is v10 the same as Firebase
use the following dependencies that are here under
com.google.android.gms:play-services-nearby:10.0.1
com.google.firebase:firebase-core:10.0.1
com.google.firebase:firebase-messaging:10.0.1

Google Play Services 9.2.1 and google-services plugin

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?
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.
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.

Categories

Resources