Unable to get the exact reason of crash while using Realm + Okhttp - android

I am using Realm and my app crashes with the following traces and I don't get any idea to resolve this. This is the only stack strace that I see on the console. Nothing else :
FATAL EXCEPTION: OkHttp Dispatcher
java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.Object.equals(java.lang.Object)' on a null object reference
at io.realm.RealmConfiguration.equals(RealmConfiguration.java:186)
at io.realm.RealmCache.validateConfiguration(RealmCache.java:217)
at io.realm.RealmCache.createRealmOrGetFromCache(RealmCache.java:103)
at io.realm.Realm.getInstance(Realm.java:213)
at io.realm.Realm.getInstance(Realm.java:176)
at testapp.WebClient.WebClientAPICalls$2.onResponse(WebClientAPICalls.java:74)
at okhttp3.RealCall$AsyncCall.execute(RealCall.java:133)
at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
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)
This is the line 74: Realm realm = Realm.getInstance(context);
I am not sure what the exact reason is for this crashing. Any help in this regard is highly appreciated.

So just for the information to the people out here, as confirmed by # Christian Melchior, it was a bug with the latest version of realm 0.88.0.
Hence I had to rollback to the version 0.87.5 for now in order to resolve the issue.
Christian Melchior, who works at #Realm.io has also confirmed that they are releasing a fix for this bug as soon as possible and hence the latest version should be good to go.

Related

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

Exception while Dropbox API tries to read a resource - might be multidex issue?

I have an Android app with Dropbox support. Lately I've started getting an exception for some users. I can not reproduce it. It affects just a few users. The exception happens when Dropbox tries to access /sdk-version.txt which is one of their resources. On Android Studio I can see the resource is there, here is a screenshot:
And like I said, it doesn't happen for me or for most of my users. If I use apktool on my apk, the sdk-version.txt file shows up on a folder called unknown. I see a lot of other files there but most have a package, this one doesn't. Not sure if that matters.
I also have this line on my gradle file multiDexKeepFile file('multidex-config.txt') and in there I have:
com.dropbox.core.DbxRequestUtil
com.dropbox.core.http.HttpRequestor
com.dropbox.core.DbxSdkVersion
Those were all attempts at fixing this but it didn't help.
So far the exception has happened on Android 5 and 6 across multiple manufacturers. This is the exception:
Fatal Exception: java.lang.ExceptionInInitializerError
at com.dropbox.core.DbxRequestUtil.buildUserAgentHeader(DbxRequestUtil.java:151)
at com.dropbox.core.DbxRequestUtil.addUserAgentHeader(DbxRequestUtil.java:136)
at com.dropbox.core.DbxRequestUtil.startPostRaw(DbxRequestUtil.java:233)
at com.dropbox.core.v2.DbxRawClientV2$1.execute(DbxRawClientV2.java:107)
at com.dropbox.core.v2.DbxRawClientV2.executeRetriable(DbxRawClientV2.java:284)
at com.dropbox.core.v2.DbxRawClientV2.rpcStyle(DbxRawClientV2.java:102)
at com.dropbox.core.v2.users.DbxUserUsersRequests.getCurrentAccount(DbxUserUsersRequests.java:120)
at mypackage.UserDropbox.(UserDropbox.java)
at mypackage.DropboxHelper$1.run(DropboxHelper.java)
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:81smiling face with sunglasses
Caused by java.lang.NullPointerException: Attempt to invoke virtual method 'void java.util.jar.JarVerifier.removeMetaEntries()' on a null object reference
at java.util.jar.JarFile.getInputStream(JarFile.java:381)
at libcore.net.url.JarURLConnectionImpl.getInputStream(JarURLConnectionImpl.java:222)
at java.net.URL.openStream(URL.java:470)
at java.lang.ClassLoader.getResourceAsStream(ClassLoader.java:444)
at java.lang.Class.getResourceAsStream(Class.java:1412)
at com.dropbox.core.DbxSdkVersion.loadLineFromResource(DbxSdkVersion.java:34)
at com.dropbox.core.DbxSdkVersion.loadVersion(DbxSdkVersion.java:56)
at com.dropbox.core.DbxSdkVersion.(DbxSdkVersion.java)
at com.dropbox.core.DbxRequestUtil.buildUserAgentHeader(DbxRequestUtil.java:151)
at com.dropbox.core.DbxRequestUtil.addUserAgentHeader(DbxRequestUtil.java:136)
at com.dropbox.core.DbxRequestUtil.startPostRaw(DbxRequestUtil.java:233)
at com.dropbox.core.v2.DbxRawClientV2$1.execute(DbxRawClientV2.java:107)
at com.dropbox.core.v2.DbxRawClientV2.executeRetriable(DbxRawClientV2.java:284)
at com.dropbox.core.v2.DbxRawClientV2.rpcStyle(DbxRawClientV2.java:102)
at com.dropbox.core.v2.users.DbxUserUsersRequests.getCurrentAccount(DbxUserUsersRequests.java:120)
at mypackage.UserDropbox.(UserDropbox.java)
This isn't a direct solution.
You can integrate fabric clashlytics into your app to get a full report on the cause of the exception and information on the type and OS of devices experiencing the Exception.

Firebase Analytics keeps causing errors in Android, why?

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

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

What is the reason that crash has occurred in Splunk? (splunk crash)

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

Categories

Resources