Hari
Hari

Reputation: 442

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)

Upvotes: 10

Views: 2514

Answers (2)

Salam Hiyali
Salam Hiyali

Reputation: 379

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.

Upvotes: 6

Luca Rocchi
Luca Rocchi

Reputation: 6484

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

Upvotes: 5

Related Questions