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
Related
I'm getting an error from different device versions (Android 5 - Android 8) since I use ads:
implementation 'com.google.android.gms:play-services-ads:16.0.0'
My error looks like this:
Fatal Exception: java.lang.NullPointerException: uriString
at android.net.Uri$StringUri.<init>(Uri.java:475)
at android.net.Uri$StringUri.<init>(Uri.java)
at android.net.Uri.parse(Uri.java:437)
at com.google.android.gms.ads.internal.video.a.a(:com.google.android.gms.dynamite_adsdynamite#14366046#14.3.66 (040306-213742215):13)
at com.google.android.gms.ads.internal.video.gmsg.f.a(:com.google.android.gms.dynamite_adsdynamite#14366046#14.3.66 (040306-213742215):148)
at com.google.android.gms.ads.internal.webview.j.a(:com.google.android.gms.dynamite_adsdynamite#14366046#14.3.66 (040306-213742215):293)
at com.google.android.gms.ads.internal.webview.ac.run(Unknown Source:4)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at com.google.android.gms.ads.internal.util.e.dispatchMessage(:com.google.android.gms.dynamite_adsdynamite#14366046#14.3.66 (040306-213742215):5)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6776)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1518)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1408)
any help is apreciated
There is a bug in version 17.0.0 either you're using
implementation 'com.google.android.gms:play-services-ads:17.0.0' //or
implementation 'com.google.firebase:firebase-ads:17.0.0'
You can check this thread for more detail.
According to the post from Mobile Ads SDK Team member, issue has been fixed but there is no ETA as of now.
EDIT
I found that above issue is not related to particular admob version. From last week most of the apps with AdMob start crashing, It doesn't matter what admob version you're using. I think there is issue with server side or how they delivered ads(may be getting null in response) and not handled in AdMob SDK level.
So Currently we've
Issue with Server side
May be some issue in version 17.0.0
Issue already submitted to Mobile Ads SDK team so we've only option to wait for server side fixes or we may get another release after 17.0.0.
I also encountered this issue when I upgraded my ads dependency to the latest version, to find a proper solution keep checking this thread as mentioned by #Aryan in other answer. As a workaround for now you can use the following dependency:
implementation 'com.google.android.gms:play-services-ads:15.0.0'
this will keep the crash from occurring.
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
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.
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
I use Splunk error reporting system in android.
today suddenly encountered the following crash report.
I don't know why this crash occurred.
please let me know if you know reason of this crash
thanks in advance.
java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String org.json.JSONObject.toString()' on a null object reference
at com.splunk.mint.RemoteSettings.com.splunk.mint.RemoteSettingsData convertJsonToRemoteSettings(java.lang.String)(SourceFile:38)
at com.splunk.mint.ActionEvent.void send(android.content.Context,com.splunk.mint.NetSender,boolean)(SourceFile:111)
at com.splunk.mint.Mint$2.void run()(SourceFile:183)
at java.lang.Thread.run(Thread.java:818)
please tell me if you are encountered same problem.
We got the issue with Mint 4.3.0, answer from Splunk Support :
General Support, Sep 10, 12:32: Hi - Thank you for reaching out and
providing detailed information. We're sorry for the impact of this
issue. The issue is now resolved. If you continue to see issues,
please let us know.
Hopefully they will release a fix to protect client against that