FCM 15.0.2 cannot make token in release build with Dexguard

firebase cloud messaging proguard
firebase cloud messaging android not working
signin apk
google sign in not working in release apk
didn t find class com google firebase iid firebaseinstanceidreceiver
google sign in not working in signed apk
unable to instantiate receiver com google firebase iid firebaseinstanceidreceiver
gmail login not working in signed apk

I'm Using FCM with Dexguard. FCM cannot make token in release build. but, it works well in debug build.

my gradle settings

classpath 'com.google.gms:google-services:3.2.1'
compile 'com.google.android.gms:play-services-base:15.0.2'
compile 'com.google.android.gms:play-services-analytics:15.0.2'
compile 'com.google.firebase:firebase-core:15.0.2'
compile 'com.google.firebase:firebase-messaging:15.0.2'

And, ShrinkResources = false And optimize 5time by Dexguard

gradle version : 4.1 android gradle plugin : 2.3.3

options in dexguardFile related with FCM

-keep public class com.google.firebase.** { *; }
-keep public class com.google.firebase.iid.FirebaseInstanceId { public *;}

Firebase 15+ requires some additional rules. The latest DexGuard version 8.2.09 for example includes all necessary configurations.

FCM 15.0.2 cannot make token in release build with Dexguard, Add the following dexguard rules to fix the problem: -keep class com.google.​firebase** { *; } -dontshrink. It seems that dexguard removes all classes that are not  You can call the Instance ID API to check if a token is valid. Some other methods are discussed in this Stack Overflow post. Yes; You can call getToken again instead of worrying about caching the token yourself (The FCM SDK caches it for you). The only time you need to store tokens is if you're targeting specific tokens in your sends from your

Add the following dexguard rules to fix the problem:

-keep class com.google.firebase** { *; }
-dontshrink

It seems that dexguard removes all classes that are not directly referenced in code. So the entry points like services classes to get firebase tokens (FirebaseInstanceIdService) will be removed during obfuscation process, if shrinking is allowed.

Token not generating in release variant APK of the app · Issue #739 , I have tried everything and can't seem to find the issue . Hey @evollu Thanks for taking time to take look at issue. Build Generate Signed APK, and adb install ~/path/to/release.apk; Run on device, I get no sendRemote(notif); }); // this method call when FCM token is update(FCM token update any time  The FCM registration tokens of installed instances of your apps might change once after updating dependencies to their latest versions. To learn if your apps are affected, review the Firebase installations documentation. Also, make sure to monitor FCM registration token generation using the #onNewToken implementation.

I had similar issues with Firebase analytics where it works for debug build but not the release build, thanks to T. Neidhart's answer above I found this block from the Dexguard 8.4.13 sample - samples/advanced/GooglePlayServices/AdMob/dexguard-project.txt and it solves the problem for me.

-keep public class !**.internal.**, com.google.** {
    public protected *;
}
# We can repackage all obfuscated classes in a new internal package.
-repackageclasses com.google.internal

firebase.messaging().getToken() causes crash on android with , Issue only android build with dexguard occurs error with this error message when call firebase.messaging().getToken(). getToken() causes crash on android with dexguard release app. #1090 compile 'com.google.firebase:firebase-​messaging:15.0.2' compile You can't perform that action at this time. My android emulator works as expected but all devices I have tested (Galaxy S4 with android 5.0.6 and LG-D727 with android 5.0.2) get null as the token. Putting getToken in a looped timeout as suggested by ironbone simply resulted in getting null every second indefinitely. The null token devices also do not receive any push notifications.

لا يمكن لـ FCM 15.0.2 إنشاء رمز مميز في الإصدار باستخدام Dexguard , When migrating from GCM to FCM I discovered that the application crashes when I made a build with dexguard on. therefore I made an debug build with the same dexguard rules as a release build. getToken(java.lang. FCM / IID creates an FCM token whether or not you register for remote notifications, it's just that there is no APNs device token associated with that FCM token yet. When an APNs token is provided, the FCM token is updated on the backend to be associated with that APNs token, and notifications can now be sent via APNs using that FCM token.

Firebase and Dexguard, FCM 15.0.2 cannot make token in release build with Dexguard. 2018-05-14 android firebase firebase-cloud-messaging dexguard  IMO the problem is .init () when called by JS - the app registers, gets a token and the token will be stored. At the next .init () the stored token will be delivered instead of asking again for the token. At the moment the code assumes that onTokenRefresh will update the stored token.

dexguard- Program QA, Firebase 15+ richiede alcune regole aggiuntive. L'ultima DexGuard versione 8.2.​09 per esempio include tutte le configurazioni necessarie. New FCM id-Token invalid when app is Updated - posted in Android: Hi guys, After migrating from the old plugin to the new FCM-based plugin, i notice this problem. When a user updates the app from an old version (which was build using old GCM plugin), to the new updated app (build using new FCM based plugin), the new token-id received (usually

Comments
  • You could try the latest versions of the plugins: com.google.gms:google-services:3.3.1 and com.android.tools.build:gradle:3.1.0.
  • okay, I'll try it
  • @KyeongraeCho: Did you fix the problem? I have exactly the same problem. The Method onTokenRefresh() of FirebaseInstanceIdService will not get called in release version with dexguard, only in debug version. All Libraries up to date.
  • @user2082415 I cannot fix it yet.
  • I am using firebase since the first of project with dexguard. Only 15.x firebase makes problem