Crash in Android 8 and 9 after applying dexguard
See original GitHub issue- Android Studio version: Android Studio 3.6.1
- Firebase Component: Firebase-messaging
- Component version: 19.0.1
Crash in Android 8 and 9 in the background when sending push notification through firebase after applying dexguard obfuscation, same issue happen after updating the Firebase to 20.10
android.content.res.Resources$NotFoundException: String resource ID #0x0
at android.content.res.Resources.getText(Resources.java:363)
at android.content.res.Resources.getString(Resources.java:456)
at android.content.Context.getString(Context.java:580)
at o.hc.ɩ(SourceFile:243)
at o.he.ι(SourceFile:5007)
at o.gW.ι(SourceFile:59)
at o.fC.run(SourceFile:3002)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at o.ɬі.run(Unknown Source:6)
at java.lang.Thread.run(Thread.java:764)
our firebase Messaging Service Implementation: `public class ShahidFirebaseMessagingService extends FirebaseMessagingService {
private static final String TAG = ShahidFirebaseMessagingService.class.getSimpleName();
public static final String KEY_URL = "url";
@Override
public void onNewToken(String registrationToken) {
super.onNewToken(registrationToken);
if (BuildConfig.DEBUG) {
Log.d("TOKEN", "--->> " + registrationToken);
}
}
@Override
public void onMessageReceived(RemoteMessage remoteMessage) {
// Check Remote Message
if (remoteMessage == null) {
Log.e(TAG, "RemoteMessage is null");
return;
}
// Check Notification In RemoteMessage
if (remoteMessage.getNotification() == null) {
Log.e(TAG, "Notification is null");
return;
}
String messageId = remoteMessage.getMessageId();
RemoteMessage.Notification remoteMessageNotification = remoteMessage.getNotification();
String title = remoteMessageNotification.getTitle();
String content = remoteMessageNotification.getBody();
if (TextUtils.isEmpty(content)) {
Log.e(TAG, "Notification message content is null or empty");
return;
}
Context context = getApplicationContext();
Map<String, String> customDataMap = remoteMessage.getData();
String deepLinkUrl = null;
if (customDataMap != null && customDataMap.containsKey(KEY_URL)) {
deepLinkUrl = customDataMap.get(KEY_URL);
}
Notification localNotification = NotificationHandler.getInstance(context).buildNotification(R.mipmap.ic_launcher, title, content, deepLinkUrl);
// Using hash code since notification id is String by default
NotificationHandler.getInstance(context).notify(Math.abs(messageId.hashCode()), localNotification);
}
}`
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Dexguard crashing after library added with native code
That might happen when DexGuard obfuscates your native methods. The latest version 7.1.29 should fix this issue, please give it a try.
Read more >Android App Security and Obfuscation | DexGuard
DexGuard is a leader in Android app security with advanced code hardening (obfuscation and encryption) and runtime application self-protection. Learn more.
Read more >Application crashes at runtime [72039872] - Visible to Public
We are seeing issues with D8, when using a library that uses Dagger. I'm seeing the following issue/error during runtime.
Read more >Shrink, obfuscate, and optimize your app - Android Developers
When you build your project using Android Gradle plugin 3.4.0 or higher, the plugin no longer uses ProGuard to perform compile-time code optimization....
Read more >Android agent release notes - New Relic Documentation
New in this release Add support for DexGuard 9 End of life for supporting android SDK 21 (Android 5) to 23 (Android 6)...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I found the problem. Firebase load a string with name and not with R.string… int var5 = var0.getResources().getIdentifier(“fcm_fallback_notification_channel_label”, “string”, var0.getPackageName()); Then Dexguard remove this string.
With these two lines in the dexguard configuration you specify to keep the string above and all the strings that start with “fcm_” -keepresources string/fcm_fallback_notification_channel_label -keepresources string/fcm_*
@TizioIncognito it’s working Thank you!, but I think it should be handled inside the Firebase library so I will keep the issue open