android - 在android项目上需要('react-native-xmpp'时出错)

标签 android reactjs react-native npm

我尝试在 React Native 项目中安装 XMPP 模块 https://www.npmjs.com/package/react-native-xmpp

但是在我使用之后

var XMPP = require('react-native-xmpp');

返回错误

Cannot read property 'PLAIN' of undefined

Module AppRegistry is not a registered callable module (calling runApplication)

这是我的 react native 版本

react-native: 0.57.1
react-native-cli: 2.0.1

我没有找到这个错误发生在哪里 请帮忙

这里是配置截图

enter image description here

enter image description here enter image description here

最佳答案

您在build.gradle 依赖项中实现了xmpp! 冗余

表示它写了两次 先把那个去掉

然后去

cd android

使用 android gradlew 清理它!

cd ./gradlew && clean

之后运行 react-native run-android

它应该可以让您解决该错误!现在接下来取决于您如何配置 XMPP

关于android - 在android项目上需要('react-native-xmpp'时出错),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53925345/

相关文章:

java - 在java文件之间使用静态方法

java - 取消 AlarmManager

javascript - React.js 井字游戏。 `key` 真的有效吗?

javascript - 注册 Amazon Web Service Cognito 错误 InvalidParameterException

ios - React Native navigator.geolocation.getCurrentPosition 如何自定义 Alert Text Message

android - 图像未按比例放大 (Android)

android - 如何提高 OpenCV 实时检测器应用程序的 fps?

node.js - 在 django 服务的 React ES6 应用程序中找不到 index.js

reactjs - 使用 React Router V4 重定向到 ReactJS 组件上的服务器路由

react-native - 使用闪屏 react native 不显示图像