EddyVerbruggen / nativescript-plugin-firebase

:fire: NativeScript plugin for Firebase
https://firebase.google.com
MIT License
1.01k stars 446 forks source link

Push Notification Crash APP #1109

Open ematechno opened 5 years ago

ematechno commented 5 years ago

On some devices, when my APP is running in backgroud and a push notification is received, the APP crashes with the error below:

Fatal Exception: java.lang.NoSuchMethodError: No virtual method setChannelId(Ljava/lang/String;)Landroid/support/v4/app/NotificationCompat$Builder; in class Landroid/support/v4/app/NotificationCompat$Builder; or its super classes (declaration of 'android.support.v4.app.NotificationCompat$Builder' appears in /data/app/com.xxx.xxx-yW-oS6rEmT0n8LMhwa5cbQ==/base.apk) at com.google.firebase.messaging.zza.zzh(Unknown Source:187) at com.google.firebase.messaging.FirebaseMessagingService.zzd(Unknown Source:57) at com.google.firebase.iid.zzg.run(Unknown Source:4) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636) at com.google.android.gms.common.util.concurrent.zza.run(Unknown Source:6) at java.lang.Thread.run(Thread.java:764)

The issue looks similar to this one: https://github.com/invertase/react-native-firebase/issues/1550

From Firebase Console, I got that involved devices were running Android 8.0.0 and Android 8.1.0. Any advice? :(


Below my "app.gradle":

android {
defaultConfig {
generatedDensities = [] applicationId = "com.xxx.xxx" multiDexEnabled true }
aaptOptions {
additionalParameters "--no-version-vectors"
} project.ext { googlePlayServicesVersion = "16.0.0" } } configurations.all { resolutionStrategy.eachDependency { DependencyResolveDetails details -> def requested = details.requested if (requested.group == "com.android.support") { if (!requested.name.startsWith("multidex")) { details.useVersion "25.3.0" } } } }

Package.json:

"dependencies": { "@angular/animations": "^6.1.10", "@angular/common": "^6.1.10", "@angular/compiler": "^6.1.10", "@angular/core": "^6.1.10", "@angular/forms": "^6.1.10", "@angular/http": "^6.1.10", "@angular/platform-browser": "^6.1.10", "@angular/platform-browser-dynamic": "^6.1.10", "@angular/router": "^6.1.10", "base-64": "^0.1.0", "nativescript-angular": "~6.0.0", "nativescript-plugin-firebase": "^7.3.0", "reflect-metadata": "~0.1.10", "rxjs": "~6.1.0", "tns-core-modules": "^4.2.1", "zone.js": "~0.8.18"

EddyVerbruggen commented 5 years ago

Some devices?

ematechno commented 5 years ago

From Firebase Console, I saw exceptions for these devices: Samsung (SM-N960F, SM-A530F, SM-J530F, ...), HUAWEI (WAS-LX1A), ...

MrZhaozhirong commented 5 years ago

the problem is solved? I also catch this crash now o(╥﹏╥)o

EddyVerbruggen commented 5 years ago

If you're using the Android support library with a version before 26 you will get that error. So check your project and see if for instance you have defined supportVersion somewhere. Or any other library/plugin setting it to either a version lower than 26 or +. In the latter case update your support repo via Android Studio.