您的位置:首页 > Web前端 > React

Android react native 嵌入到现有的原生应用遇到的问题

2017-06-15 16:35 555 查看
问题1:

Caused by: java.lang.IllegalAccessError: Method 'void android.support.v4.net.ConnectivityManagerCompat.<init>()' is inaccessible to class 'com.facebook.react.modules.netinfo.NetInfoModule' (declaration of 'com.facebook.react.modules.netinfo.NetInfoModule' appears in /data/app/xxc.application1-1/base.apk

解决方法:修改 app/build.gradle

compile 'com.android.support:appcompat-v7:23.0.1'

问题2:

Native: Got JS Exception: TypeError: undefined is not a function (evaluating '(bridgeConfig.remoteModuleConfig||[]).forEach')
11-05 12:20:24.257 4879-5218/xxc.application1 E/unknown:React: Exception in native call from JS
com.facebook.react.bridge.JSExecutionException: TypeError: undefined is not a function (evaluating '(bridgeConfig.remoteModuleConfig||[]).forEach')


解决方法:添加或修改maven的路径:项目根目录的build.gradle下

allprojects {
repositories {
jcenter()
maven {
// All of React Native (JS, Android binaries) is installed from npm
url "$rootDir/node_modules/react-native/android"
}
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: