Parse-SDK-Android
Parse-SDK-Android copied to clipboard
After adding Parse FCM SDK, newly installed versions of the app crash when first opened
I just followed the steps to add FCM support to my Parse Android app, and the application has been running fine when developing locally. However, after pushing the update to the Play Store, every single new install crashes on start. After the crash, the app can be re-opened an ran successfully (although no push notifications are being received).
This is the error I'm seeing in our crash reports:
Fatal Exception: java.lang.IllegalAccessErrorIllegal class access ('com.parse.fcm.ParseFCM' attempting to access 'com.parse.PLog') in attempt to invoke static method void com.parse.PLog.d(java.lang.String, java.lang.String) (declaration of 'com.parse.fcm.ParseFCM' appears in /data/app/com.emelianov.audio-2/base.apk:classes60.dex) Raw Text
| com.parse.fcm.ParseFCM.register (ParseFCM.java:29) | com.parse.fcm.ParseFirebaseInstanceIdService.onTokenRefresh (ParseFirebaseInstanceIdService.java:26) | com.google.firebase.iid.FirebaseInstanceIdService.zzd (Unknown Source) | com.google.firebase.iid.zzc.run (Unknown Source) | java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1133) | java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:607) | com.google.android.gms.common.util.concurrent.zza.run (Unknown Source) | java.lang.Thread.run (Thread.java:761)
My suspicion is that I'm providing the wrong token somehow, but I'm not sure why this would be surfacing as an IllegalAccessError... Any help would be greatly appreciated.
This also appears to be happening during onMessageReceived:
Fatal Exception: java.lang.IllegalAccessErrorIllegal class access ('com.parse.fcm.ParseFirebaseMessagingService' attempting to access 'com.parse.PLog') in attempt to invoke static method void com.parse.PLog.d(java.lang.String, java.lang.String) (declaration of 'com.parse.fcm.ParseFirebaseMessagingService' appears in /data/app/com.emelianov.audio-1/base.apk:classes60.dex) Raw Text
| com.parse.fcm.ParseFirebaseMessagingService.onMessageReceived (ParseFirebaseMessagingService.java:16) | com.google.firebase.messaging.FirebaseMessagingService.zzd (Unknown Source) | com.google.firebase.iid.zzc.run (Unknown Source) | java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1133) | java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:607) | com.google.android.gms.common.util.concurrent.zza.run (Unknown Source) | java.lang.Thread.run (Thread.java:761)
Do your dependencies of Parse and Parse-FCM match up on the version number?
@Jawnnypoo yep, looks like it.
Here's what I've got in my build.gradle:
compile "com.github.parse-community.Parse-SDK-Android:parse:1.18.5"
compile "com.github.parse-community.Parse-SDK-Android:fcm:1.18.5"
compile 'com.google.firebase:firebase-core:16.0.1'
}
apply plugin: 'com.google.gms.google-services'
and then up top under buildscript dependencies I'm using
classpath 'com.google.gms:google-services:4.0.1'
Also added these 2 things to my AndroidManifest.xml
<service
android:name="com.parse.fcm.ParseFirebaseInstanceIdService"
android:exported="true">
<intent-filter>
<action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
</intent-filter>
</service>
<service
android:name="com.parse.fcm.ParseFirebaseMessagingService">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT"/>
</intent-filter>
</service>
and removed the old com.parse.PushService, com.parse.GcmBroadcastReceiver, and com.parse.push.gcm_sender_id
This seems really odd. Can you recreate this crash locally, or do you only see it in your crash reporting tool?
@Jawnnypoo sorry for the late response.
When I debug the app locally on my device, I can not reproduce the crash
However, when I download the production version of the app from the Play Store, I am consistently able to reproduce the crash (but only the first time I launch the app after installing, presumably because the FCM token registration is failing).
Is it possible there's something different between my debug build configuration and my release build configuration that's causing the problem?
Do you use proguard in your release builds?
Also, it would be good to know if you have Parse.setLogLevel
anywhere in your codebase, and if so, what you have it set to.
Hey @Jawnnypoo, there are no instances of Parse.setLogLevel anywhere in the project.
I am using proguard in my release build, here's what the configuration looks like in my build.gradle:
buildTypes {
release {
shrinkResources false
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}