Firebase Analytics keeps causing errors in Android, why? - android

After I installed Firebase Analytics in my Android app, I keep getting the following error and crash of the app.
10-03 19:08:03.917 17740-17759/******* E/FA: Task exception on worker thread: java.lang.IncompatibleClassChangeError:
The method 'java.io.File android.support.v4.content.ContextCompat.getNoBackupFilesDir(android.content.Context)' was expected to be of type virtual but instead was found to be of type direct
(declaration of 'com.google.firebase.iid.zzg' appears in /data/data/********/files/instant-run/dex/slice-com.google.firebase-firebase-iid-9.0.0_4ac10bd34145eacbd51560cb14cd41a784d8c1aa-classes.dex): com.google.android.gms.measurement.internal.zzt.zzEd(Unknown Source)
Any idea why and what causes this error?

I think something was wrong in the documentation. The instructions didn't tell me this extra step.
I was missing a dependency:
compile 'com.google.firebase:firebase-core:9.6.1'
In the support docs, however it is clearly mentioned. I added it and it works fine now.

What Firebase version are you using? Try to update it to latest version, 9.6
Reference: https://developers.google.com/android/guides/releases

Related

java.lang.IncompatibleClassChangeError: Class 'org.apache.http.message.BasicHeader' does not implement interface 'org.apache.http.NameValuePair'

I have an issue in Released APK. java.lang.IncompatibleClassChangeError Error comes when install and open release APK. But my debug APK is working properly. I saw lot of links and stackoverflow question but I didn't got any solution. What should I do?
java.lang.IncompatibleClassChangeError: Class 'org.apache.http.message.BasicHeader' does not implement interface 'org.apache.http.NameValuePair' in call to 'java.lang.String org.apache.http.NameValuePair.getName()' (declaration of 'com.android.volley.toolbox.BasicNetwork' appears in /data/app/com.mypackage.myprojectname-XI7DFLjbpTwZkGhQ3WYiBQ==/base.apk)
at com.android.volley.toolbox.BasicNetwork.convertHeaders(SourceFile:3)
at com.android.volley.toolbox.BasicNetwork.performRequest(SourceFile:8)
at com.android.volley.NetworkDispatcher.run(SourceFile:8)
Any help will be appreciated.
Thanks.
I have added volley library & resolved my issue.
implementation 'com.android.volley:volley:1.1.1'

Android: Facebook SDK for Android crashes with Nullpointer in Class UserSettingsManager

Facebook SDK crashes randomly,
it doesn't give any info regarding what this crash is about;
we don't even know the action when this is happening and we are not able to reproduce this.
Gradle setting
implementation 'com.facebook.android:facebook-android-sdk:[4,5)'
We are using facebook sbk to send events to FB analytics
Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean org.json.JSONObject.optBoolean(java.lang.String, boolean)' on a null object reference
at com.facebook.UserSettingsManager$1.run(UserSettingsManager.java:148)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
at java.lang.Thread.run(Thread.java:764)
According to this reply from Marc Hayek of the Facebook team, we may upgrade the version to fix the issue.
implementation 'com.facebook.android:facebook-login:4.41.0'
Hope this helps you.
After some investigation i realized that the bug has been introduced in sdk 4.40
so i have changed gradle to
implementation 'com.facebook.android:facebook-login:4.39.0'
and that should remove the bug until a fixed newer FB sdk will be released

Pre-launch-report failures due to missing methods (in com.google.android.apps.mtaas.crawler-1/base.apk)

Since recently my app started to contain strange error messages in the pre-launch reports (automatically generated after upload to the Play store).
These reports contain exceptions such as the following:
Exception java.lang.NoSuchMethodError: No interface method a(Landroid/arch/lifecycle/e;Landroid/arch/lifecycle/b$a;)V in class Landroid/arch/lifecycle/GenericLifecycleObserver; or its super classes (declaration of 'android.arch.lifecycle.GenericLifecycleObserver' appears in /data/app/com.google.android.apps.mtaas.crawler-1/base.apk)
android.arch.lifecycle.f$a.a (f.java:326)
android.arch.lifecycle.f.a (f.java:159)
com.firebase.ui.database.FirebaseRecyclerAdapter.<init> (FirebaseRecyclerAdapter.java:40)
And:
Exception java.lang.NoSuchMethodError: No static method a(Landroid/app/Activity;)V in class Landroid/arch/lifecycle/ReportFragment; or its super classes (declaration of 'android.arch.lifecycle.ReportFragment' appears in /data/app/com.google.android.apps.mtaas.crawler-1/base.apk)
android.arch.lifecycle.LifecycleDispatcher$DispatcherActivityCallback.onActivityCreated (LifecycleDispatcher.java:77)
android.app.Application.dispatchActivityCreated (Application.java:219)
android.app.Activity.onCreate (Activity.java:1040)
android.support.v4.app.SupportActivity.onCreate (SupportActivity.java:66)
android.support.v4.app.FragmentActivity.onCreate (FragmentActivity.java:285)
android.support.v7.app.AppCompatActivity.onCreate (AppCompatActivity.java:84)
And:
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'int android.arch.core.internal.SafeIterableMap.size()' on a null object reference
at android.arch.lifecycle.LifecycleRegistry.getObserverCount(LifecycleRegistry.java:204)
at android.arch.lifecycle.ProcessLifecycleOwner.b(ProcessLifecycleOwner.java:154)
at android.arch.lifecycle.ProcessLifecycleOwner.a(ProcessLifecycleOwner.java:100)
at android.arch.lifecycle.LifecycleRuntimeTrojanProvider.onCreate(LifecycleRuntimeTrojanProvider.java:36)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1751)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1726)
at android.app.ActivityThread.installProvider(ActivityThread.java:6031)
... 10 more
The strange thing is that my released app seems to be running fine on real devices (the exceptions appear only during the pre-launch tests).
I tried to revert all (major) changes performed since the last build in which I had no pre-launch problem: from API 26 back to API 27, older version of the support libs, no D8 etc., but no success so far: of the 9 tests being performed only 1 or 2 succeed, the rest fails with this type of errors.
What can I do to solve this?
Just got an answer from Google Play developer support. They are looking into the problem.
As a workaround you can go back to the previous version of the crawler by opting out of the newly released one.
Here's how to opt-out:
Sign in to your Play Console.
Select an app.
Select Release
management > Pre-launch report > Settings. In the “Pre-launch report
version” section, move the Opt-out switch to the right until it turns
blue.
After this, the launch reports appear correctly again.
PS - This will disable the default tests done by the Google Play and you might miss any other errors from other cause. Hence, be sure to implement your own tests before releasing into production.
The Gson error was caused by a regression. The issue has been fixed. It should work as expected after the fix is released in a day or two.

Firebase Crash Library - NullPointerException in the console

I've implemented the new Firebase Crash library (https://github.com/firebase/quickstart-android/tree/master/crash) to log error in Android app.
Anyone is having similar problem.
I'm checking errors and on the top I've got:
Exception java.lang.NullPointerException: Attempt to invoke virtual method 'byte[] java.lang.String.getBytes()' on a null object reference
android.util.Base64.decode (Base64.java:118)
com.google.firebase.iid.zzg.zzeH (zzg.java:)
com.google.firebase.iid.zzg.zzeE (zzg.java:)
com.google.firebase.iid.zzd.zzCd (zzd.java:)
com.google.firebase.iid.zzd.zzc (zzd.java:)
com.google.firebase.iid.zzd.getToken (zzd.java:)
com.google.firebase.iid.FirebaseInstanceId.getToken (FirebaseInstanceId.java:)
com.google.firebase.iid.FirebaseInstanceId.zzUo (FirebaseInstanceId.java:)
com.google.firebase.iid.FirebaseInstanceIdService.zza (FirebaseInstanceIdService.java:)
com.google.firebase.iid.FirebaseInstanceIdService.zzm (FirebaseInstanceIdService.java:)
com.google.firebase.iid.zzb$2.run (zzb.java:)
java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1112)
java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:587)
java.lang.Thread.run (Thread.java:818)
I have checked but there are not extra proguard rules for Firebase Crash.
Is it bug in the library? Anyone is having similar problem?
I can't reproduce error on my devices.
The error is strange and I don't know in which place in the application. Nothing so I think it's connected to Crash library.
This is not standard nullexception. It's connected to Firebase Crash library. Why I'm thinking this is library bug - there is no sign on my code/activity here.
It was confirmed by Google that this was bug in the InstanceID library.
All you can do right now is to update to the latest version and hope this will be fixed.
compile 'com.google.firebase:firebase-crash:9.4.0'
Note #1
You can see in the comments that some people are still getting this error. At the moment we can't do nothing more than update to the latest version. If you've been using previous version - update to the latest. We need info from Firebase team about it.
Note #2
This seems to be fixed in 9.4.0 but we still need confirmation
Seems to be fixed in
compile 'com.google.firebase:firebase-crash:9.4.0'
This is a bug in the InstanceID library in 9.0, sorry. We've identified a fix and will include it in a future SDK release.
We believe it should be fairly rare, but please comment if you're seeing a large number of devices.
There is a new version of Google Play Services available: 9.2.1. Apparently it has the fix inside. I'll confirm it once I have enough data.

NPE on Facebook SDK 4.10 : Attempt to invoke interface method 'java.lang.Object com.facebook.inject.Lazy.get()' on a null object reference

Background
Recently we've updated the Facebook SDK library to 4.10 (from here).
Before, we had the same bug now and then, but now it seems it occurs a lot more often.
The problem
There is no way for us to understand where and why it occurs.
Here's the crash log:
Fatal Exception: java.lang.NullPointerException: Attempt to invoke
interface method 'java.lang.Object com.facebook.inject.Lazy.get()' on
a null object reference
at android.os.Parcel.readException(Parcel.java:1552)
at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:190)
at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:142)
at android.content.ContentProviderProxy.query(ContentProviderNative.java:421)
at android.content.ContentResolver.query(ContentResolver.java:494)
at android.content.ContentResolver.query(ContentResolver.java:429)
at com.facebook.internal.NativeProtocol.fetchAllAvailableProtocolVersionsForAppInfo(NativeProtocol.java:790)
at com.facebook.internal.NativeProtocol.access$000(NativeProtocol.java:49)
at com.facebook.internal.NativeProtocol$NativeAppInfo.fetchAvailableVersions(NativeProtocol.java:281)
at com.facebook.internal.NativeProtocol$NativeAppInfo.access$600(NativeProtocol.java:226)
at com.facebook.internal.NativeProtocol$1.run(NativeProtocol.java:763)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:818)
And, since it's a report from Crashlytics, I also have some statistics:
usually (90%) occurs on Meizu devices, and the rest on LG, Samsung and others.
usually (72%) occurs on Android 5.1 versions, and the rest on all of the other versions we support (4.x and above).
What I've tried
I tried searching for the exception, but I can't find anything even similar to it.
I tried to find the "com.facebook.inject.Lazy" class, but this is nowhere to be found. I can't even find injection related classes and repos that the sdk uses for normal use. Only for unit testings.
I also tried to go to the Github website of Facebook (here), but there is nowhere to write there.
Later I've found that this was reported on Facebook's developers website , but it doesn't seem that it's going to be fixed, and nobody knows how to handle it.
EDIT: now I've found this Facebook post, which says it might be because of using an old version of Facebook app, but it seem that it's incorrect.
The question
Why does it occur? Is there any workaround for this? Does Facebook work on a fix for this?
Is there any version of the Facebook SDK that this issue doesn't occur?
And, most importantly, How can it be handled and fixed?
Please use updated facebook sdk to overcome this error. old sdk has some problems.
you can download latest sdk from
https://developers.facebook.com/docs/android

Categories

Resources