Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Facebook SDK 4.7.0 logs ClassNotFoundException for AppEventsLogger

I integrated the FB SDK in my Android app via Gradle for log-in and tracking events. Log-in works fine, but the logcat keeps showing me an exception every 15 seconds once I try to log an app event:

D/com.facebook.appevents.AppEventsLogger: Got unexpected exception: java.lang.ClassNotFoundException: com.facebook.a.b

It gets thrown in PersistedEvents' readAndClearStore() method

Here's my code for logging the event:

AppEventsLogger logger = AppEventsLogger.newLogger(this);
    Bundle parameters = new Bundle();
    parameters.putString(AppEventsConstants.EVENT_PARAM_CURRENCY, "EUR");
    parameters.putString(AppEventsConstants.EVENT_PARAM_CONTENT_TYPE, "product");
    parameters.putString(AppEventsConstants.EVENT_PARAM_CONTENT_ID, id);

    logger.logEvent(AppEventsConstants.EVENT_NAME_VIEWED_CONTENT,
            1.99,
            parameters);

I mean com.facebook.a.b looks like a proguard issue to me. But in the FB SDK docs they clearly state that you do not need to enter any proguard rules for it to work. This error also shows when I don't minify my app and also if I download the sdk from github and include it as a module.

like image 685
Till Avatar asked Oct 17 '15 15:10

Till


1 Answers

i have a similar issue a few days ago with the logger in the Facebook SDK(v4.11.0):

D/com.facebook.a.a(PID): Got unexpected exception: java.io.WriteAbortedException: Read an exception; java.io.NotSerializableException: org.json.JSONObject

And in their documentation they said the following:

You don't have to perform any additional steps to use ProGuard for the Facebook Android SDK. For instructions on Proguard, see Android Tools Project Site, Running ProGuard.

After looking what was causing to not log any of my events in release environment i added the following rule to my proguard file and then magically started working well:

-keep class com.facebook.** { *; }

We already open a ticket to the facebook developers team in order to have more information about this. https://developers.facebook.com/bugs/250752828645777/

like image 106
JpCrow Avatar answered Nov 09 '22 09:11

JpCrow