【问题标题】:Notifee native module not found找不到 Notifee 本机模块
【发布时间】:2023-01-16 19:43:20
【问题描述】:

我有一个带有 React Native 的移动应用程序并且可以正常工作。我想向该应用程序添加通知功能。

我安装了 firebase/app、firebase/messaging 和 @notifiee 以便能够发送通知。安装这些包后,我可以在 android 模拟器上构建我的应用程序,但我在控制台上遇到这样的错误:

ERROR    Error: Notifee native module not found.
LOG      Running "myMobileApp" with {"rootTag":1}
ERROR    Invariant Violation: "myMobileApp" has not been registered. This can happen if:
* Metro (the local dev server) is run from the wrong folder. Check if Metro is running, stop it and restart it in the current project.
* A module failed to load due to an error and `AppRegistry.registerComponent` wasn't called.

我在 Ubuntu 20.04.4 LTS 上使用 Visual Studio Code、Android Studio Emulator 和 JDK 11。

我的 package.json 中的相关包:

"dependencies": {
     ...
    "@notifee/react-native": "^5.3.0",
    "@react-native-firebase/app": "^14.11.0",
    "@react-native-firebase/messaging": "^14.11.0",
    "react": "16.13.1",
    "react-native": "0.63.4",
     ...
  },

【问题讨论】:

  • 这似乎在安装阶段没有链接相应的本机模块。你使用 Expo 还是 React Native CLI
  • @ShyPenguin 我使用 React Native CLI
  • 尝试清理以前的 android 构建 cd android && ./gradlew clean
  • nevidev。可能不是这种情况,但您是否同时在ios 中运行它?如果是,请记住在 ios 和 android 中构建它并同步 pods

标签: android firebase react-native push-notification


【解决方案1】:

停止你的项目,关闭正在运行的终端窗口,然后在你的 android studio 上按下“sync project with gradle files”图标,你可以在设备管理器后面的顶部栏上找到它

重新运行你的项目

【讨论】:

    【解决方案2】:

    为我工作
    如果您正在使用 ZEGOCLOUD 视频通话。

    compileSdkVersion = 33 // <----- 在 android/build.gradle 中改变这个

    【讨论】:

      猜你喜欢
      • 2022-09-30
      • 1970-01-01
      • 2020-01-11
      • 2012-07-16
      • 1970-01-01
      • 1970-01-01
      • 2021-11-28
      • 1970-01-01
      • 2018-08-05
      相关资源
      最近更新 更多