37

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?

android developer
  • 114,585
  • 152
  • 739
  • 1,270
  • happens to us as well. Much more than it used to. It seems related to Fatal Exception: java.lang.SecurityException Requires MANAGE_APP_TOKENS permission (at least some of the crashes has this extra info) – Lior Iluz Mar 13 '16 at 12:59
  • @LiorIluz Do you also get it now more often because you've updated the SDK ? Or did you update the SDK a long time ago? Also, why do you think it's related to the SecurityException ? – android developer Mar 13 '16 at 14:10
  • I updated the SDK a month ago after a long time I didn't. I know it's related because some of the crashes with the same stack trace have this message... I'm just not sure why would Facebook want a system permission to do anything. – Lior Iluz Mar 13 '16 at 14:27
  • @LiorIluz Do you know perhaps if FB knows about this issue? Or if there is a workaround? It looks so cryptic that I can't even guess how to try to fix it. – android developer Mar 13 '16 at 14:39
  • no... I also have other issues with 4.10 (fragmenttransactions with multiple adds are backwards). Back to 4.8.1 for now. – Lior Iluz Mar 14 '16 at 07:09
  • Crash continues on 4.8.1 as well. – Lior Iluz Mar 15 '16 at 08:00
  • @LiorIluz Thank you for the warning. I almost suggested using it. – android developer Mar 15 '16 at 08:06
  • Any new solution? Same problem here. – KWA Mar 15 '16 at 08:44
  • Did you find a solution? – mr.icetea Mar 17 '16 at 14:43
  • We're having the same problem with our app. also mostly on Meizus. – nadavfima Mar 20 '16 at 08:44
  • 2
    There is an update to the sdk (4.10.1), but I don't think it handles this issue: https://developers.facebook.com/docs/android/change-log-4.x . It seems this bug is known: https://developers.facebook.com/bugs/1124238504400540/ – android developer Mar 20 '16 at 10:57
  • Now it seems that because Facebook didn't get any new information about the bug, they closed it. If anyone knows about this or can contribute to handle it, please write there. It's not nice to close a very common bug just because developers don't know how to fix it or when it occurs. The least they could have done is to try to put some fallback for it. – android developer Apr 07 '16 at 13:39
  • @androiddeveloper, I just posted on that thread. I hope they reopen it. For us, it's 97% Meizu devices (seem to come from China) so we can't exactly reproduce locally from NYC. Seems like it's almost certainly a problem with the Meizu custom ROM, but the best fix will still come from Facebook ... – Lisa Wray Apr 07 '16 at 19:25
  • @LisaWray Thank you for this. I really have no idea what information we can provide them. – android developer Apr 07 '16 at 20:12
  • Another FB post similar to this issue: https://developers.facebook.com/bugs/334280643362237/ . but they say it might be because of old version of FB app. Apparently it's not because of this. – android developer Apr 12 '16 at 11:56
  • 1
    FB SDK was updated recently to 4.11.0 but doesn't handle this bug. However, it seems the bug report has changed to "Bug confirmed" , so there might be a fix soon. – android developer Apr 18 '16 at 10:40
  • Actually, "Status: Invalid" – Braiam Apr 19 '16 at 13:54
  • @Braiam They claim now is that it's a bug on Meizu's devices. That's even though the bug exists on other devices too. I think they just don't want to handle this. – android developer Apr 19 '16 at 19:22
  • @AmolSuryawanshi Will it fix the issue? Can anyone else confirm? I don't see the bug report telling this will fix the issue. – android developer Apr 22 '16 at 11:09
  • Yes definitely..download latest sdk and try. – Amol Suryawanshi Apr 22 '16 at 12:46
  • This has been fixed only as of May 20th, 2016, v4.12.0 of the FB SDK. The changelog states "Fixed Security and NPE on some Meizu devices". See https://developers.facebook.com/docs/android/change-log-4.x#4_12_0 – savanto May 30 '16 at 20:45
  • @savanto And did it help? – android developer May 31 '16 at 09:30
  • @androiddeveloper I've had a version with this fixed SDK out for a week now, and have not had a recurrence of the crashes. So I think the Era of Meizu Tears has passed. – savanto Jun 08 '16 at 21:38
  • How do the Crashlytics stats compare to those of your overall user base? Do a lot of crashes occur on Meizu because of an issue specific to that device or because you have a lot of users with that device? – Code-Apprentice Sep 11 '16 at 19:29
  • @Code-Apprentice We've updated the SDK, and now it works fine. No crashes on Meizu devices anymore. – android developer Sep 12 '16 at 06:32
  • Still takes place. – Leo DroidCoder Aug 31 '17 at 09:09

1 Answers1

0

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

Amol Suryawanshi
  • 2,108
  • 21
  • 29