android - 没有虚拟方法 getActiveNotifications()

标签 android cordova firebase ionic3 angular5

将我的应用程序升级到以下功能后,我开始收到以下错误。 (代码没变)

我在测试中没有遇到任何错误,但是 firebase 让用户知道他们遇到了这个错误

我之前没有使用 firebase 控制台进行调试。你能帮帮我吗?

**ionic info:**
    @ionic/cli-utils  : 1.19.0
    ionic (Ionic CLI) : 3.19.0

global packages:
    cordova (Cordova CLI) : 7.1.0

local packages:
    @ionic/app-scripts : 3.1.5
    Cordova Platforms  : none
    Ionic Framework    : ionic-angular 3.9.2

System:
    Node : v8.9.3
    npm  : 5.6.0
    OS   : Windows 10

firebase console error image :

 Exception java.lang.NoSuchMethodError: No virtual method getActiveNotifications()[Landroid/service/notification/StatusBarNotification;

in class Landroid/app/NotificationManager; or its super classes (declaration of 'android.app.NotificationManager' appears in /system/framework/framework.jar) de.appplant.cordova.plugin.notification.Manager.getIdsByType (Manager.java:227) de.appplant.cordova.plugin.notification.Manager.getByType (Manager.java:279) de.appplant.cordova.plugin.notification.Manager.clearAll (Manager.java:160) de.appplant.cordova.plugin.localnotification.LocalNotification.clearAll (LocalNotification.java:350) de.appplant.cordova.plugin.localnotification.LocalNotification.access$900 (LocalNotification.java:59) de.appplant.cordova.plugin.localnotification.LocalNotification$1.run (LocalNotification.java:164) java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1112) java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:587) java.lang.Thread.run (Thread.java:818)

**package.json (dependencies):**
"@angular/common": "5.1.1",
"@angular/compiler": "5.1.1",
"@angular/compiler-cli": "5.1.1",
"@angular/core": "5.1.1",
"@angular/forms": "5.1.1",
"@angular/http": "5.1.1",
"@angular/platform-browser": "5.1.1",
"@angular/platform-browser-dynamic": "5.1.1",
"@ionic-native/android-permissions": "^4.5.2",
"@ionic-native/app-rate": "^4.5.2",
"@ionic-native/core": "4.5.2",
"@ionic-native/file": "^4.5.2",
"@ionic-native/file-transfer": "^4.5.2",
"@ionic-native/firebase": "^4.5.2",
"@ionic-native/local-notifications": "^4.5.2",
"@ionic-native/native-audio": "^4.1.0",
"@ionic-native/native-storage": "^4.5.2",
"@ionic-native/network": "^4.5.2",
"@ionic-native/splash-screen": "4.5.2",
"@ionic-native/status-bar": "4.5.2",
"@ionic/storage": "2.1.3",
"cordova-android": "7.0.0",
"cordova-plugin-android-permissions": "^1.0.0",
"cordova-plugin-app-event": "^1.2.1",
"cordova-plugin-apprate": "^1.3.0",
"cordova-plugin-badge": "^0.8.5",
"cordova-plugin-compat": "^1.2.0",
"cordova-plugin-console": "^1.1.0",
"cordova-plugin-device": "^1.1.7",
"cordova-plugin-dialogs": "^1.3.3",
"cordova-plugin-file": "^5.0.0",
"cordova-plugin-file-transfer": "^1.7.0",
"cordova-plugin-firebase": "^0.1.25",
"cordova-plugin-globalization": "^1.0.7",
"cordova-plugin-inappbrowser": "^1.7.1",
"cordova-plugin-local-notification": "^0.9.0-beta.1",
"cordova-plugin-nativeaudio": "^3.0.9",
"cordova-plugin-nativestorage": "^2.2.2",
"cordova-plugin-network-information": "^1.3.4",
"cordova-plugin-splashscreen": "^4.1.0",
"cordova-plugin-statusbar": "^2.3.0",
"cordova-plugin-whitelist": "^1.3.3",
"de.appplant.cordova.plugin.local-notification": "^0.8.5",
"ionic-angular": "3.9.2",
"ionic-audio": "^3.2.0",
"ionic-plugin-keyboard": "^2.2.1",
"ionic2-super-tabs": "^4.1.4",
"ionicons": "3.0.0",
"rxjs": "5.5.5",
"sw-toolbox": "3.6.0",
"zone.js": "0.8.18"

**package.json (cordova plugins):**
  "cordova-plugin-console": {},
  "cordova-plugin-device": {},
  "cordova-plugin-splashscreen": {},
  "cordova-plugin-statusbar": {},
  "cordova-plugin-whitelist": {},
  "ionic-plugin-keyboard": {},
  "cordova-plugin-nativeaudio": {},
  "cordova-plugin-network-information": {},
  "cordova-plugin-file-transfer": {},
  "cordova-plugin-file": {},
  "cordova-plugin-android-permissions": {},
  "cordova-plugin-firebase": {},
  "cordova-plugin-apprate": {},
  "cordova-plugin-nativestorage": {},
  "de.appplant.cordova.plugin.local-notification": {},
  "cordova-plugin-local-notification": {}

编辑-1

  • 删除了 node_modules 文件
  • 删除所有本地通知包
  • 已安装“cordova-plugin-local-notification”:“^0.9.0-beta.1”
  • 设置通知期限'munite'

完成这些后,我在 adroid 上进行了测试。应用程序崩溃并关闭。 我知道错误是在显示通知时发生的。

  • 我清除了所有通知并且应用程序正常运行。

我认为这个包与 cordova 7.0.0 不兼容。 已经在包版本是测试版。 我想我会等待兼容版本的发布...

i think this github issue is same as my problem

最佳答案

目前 Ionic Native 不支持此插件的 0.9.* 版本,which brings breaking changes .此外,您有此插件的两个不同版本:

"cordova-plugin-local-notification": "^0.9.0-beta.1",
"de.appplant.cordova.plugin.local-notification": "^0.8.5",

删除测试版并重试。也还请take a look on this thread , cordova-plugin-firebase 可能会导致您的情况出现问题。

关于android - 没有虚拟方法 getActiveNotifications(),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47866467/

相关文章:

带有 GoogleTileOverlay 的 Android MapView 不释放位图

cordova - 使用 ionic 2 CLI 创建 ionic 1.x 应用程序

cordova - 修饰 jquery mobile 的内部类比

Firebase云函数: Error: Unexpected error while acquiring application default credentials: read ECONNRESET

android - android中的等待进度条

java - 在 Android 的房间数据库中插入复合键的重复值后应用程序崩溃

android - 位图占用大量内存

javascript - 如何在 phonegap javascript 函数中返回结果?

android - 获取 native 客户端、firebase token

swift - 使用未解析的标识符 'Auth' 和没有这样的模块 'FirebaseAuth' 错误