Java.lang.IllegalStateException: Orca SharedPreferences used before initialization

I included the Facebook SDK for android v3.5 in my application and included the installation publication code:

com.facebook.AppEventsLogger.activateApp(this); 

But I get a lot of crashes caused by:

 Settings.java line 418 com.facebook.Settings.getAttributionId 

and throws an exception:

 java.lang.IllegalStateException: Orca SharedPreferences used before initialized 

I am trying to reproduce the collapse without success. Has anyone encountered this issue? I just want to know if:

 /* Only activate FaceBook publish install if the user has the FaceBook app installed */ if (com.facebook.Settings.getAttributionId(getContentResolver()) != null){ com.facebook.AppEventsLogger.activateApp(this); } 

will this fix the problem? Thanks!

+6
source share
1 answer

We finally fixed this problem by catching the exception and avoiding device activation without the facebook application installed. The facebook developer answered us:

"The user must install the Facebook Android application on his device and log in to activate the activApp function."

This is the code we finally used, and it no longer crashes:

 try{ /* Only activate FaceBook publish install if the user has the FaceBook app installed */ if (com.facebook.Settings.getAttributionId(getContentResolver()) != null){ com.facebook.AppEventsLogger.activateApp(this); } } catch (IllegalStateException e){ Log.d(TAG, "Facebook Setting Exception again!"); } 

I hope this helps others ...

+7
source

Source: https://habr.com/ru/post/954071/


All Articles