Search code examples
androidfacebookfacebook-android-sdkandroid-9.0-pie

E/com.facebook.appevents.RestrictiveDataManager: updateRulesFromSetting failed


When I launch my app from Android Studio, with Facebook SDK installed on my device, Xiaomi Mi A2, it triggers the same error trhee times. It does not stop the app, but I don't know if I am missing something or simply, it is not important, but in the end, it is an error and I want to clarify it.

I am using Android Studio 3.4.1, Android 9 on the Xiaomi A2 and the new clause in build.gradle file is implementation 'com.facebook.android:facebook-android-sdk:5.1.0'. Error has not appeared before upgrading Facebook SDK.

This is what appears in Logcat:

2019-06-24 18:24:31.202 25105-25136/com.myapp E/com.facebook.appevents.RestrictiveDataManager: updateRulesFromSetting failed org.json.JSONException: End of input at character 0 of at org.json.JSONTokener.syntaxError(JSONTokener.java:449) at org.json.JSONTokener.nextValue(JSONTokener.java:97) at org.json.JSONArray.(JSONArray.java:92) at org.json.JSONArray.(JSONArray.java:108) at com.facebook.appevents.RestrictiveDataManager.updateFromSetting(RestrictiveDataManager.java:32) at com.facebook.internal.FetchedAppSettingsManager.parseAppSettingsFromJSON(FetchedAppSettingsManager.java:323) at com.facebook.internal.FetchedAppSettingsManager.access$000(FetchedAppSettingsManager.java:63) at com.facebook.internal.FetchedAppSettingsManager$1.run(FetchedAppSettingsManager.java:181) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) at java.lang.Thread.run(Thread.java:764)


Solution

  • EDIT The issue has been fixed in version 5.1.1.


    Revert to 5.0.3 to get rid of this. 5.1.0 is actually crashing in production at this method (there's a bug report here). GitHub commits of this file show its rather flawed, the method is called from multiple threads concluding to a concurrency crash because it's using a static ArrayList.

    Lately the core FB SDK is kinda bloated with useless stuff and low-quality code. The codeless stuff "feature" that simply can't even be turned off is especially a horror to look at. If you don't strictly need the FB SDK in your app, I'd avoid it until they get their shit figured out.