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.
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/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With