Android 原生应用嵌入React-Native模块开发-环境配置及填坑记

xiaoxiao2021-02-28  97

1.Can't find variable: __fbBatchedBridge

还是在项目的根文件夹下,命令行运行如下命令,启动测试服务器。 $ npm start

但是部分Android 6.0的机型,每次启动后依然会报错,必须打以下命令才可以

adb reverse tcp:8081 tcp:8081

2.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'

gradle配置 compile 'com.android.support:appcompat-v7:23.0.1' compile "com.facebook.react:react-native:+" Android原生应用集成RN的话,必须是这个版本,不然会报这个错误

3.undefined is not an object (evaluating 'ReactInternals.ReactCurrentOwner')错误

RN版本问题,版本改为

"dependencies": { "react": "16.0.0-alpha.12", "react-native": "^0.46.1" } 后问题解决

4.undefined is not a function (evaluating '(bridgeConfig.remoteModuleConfig||[]).forEach')

allprojects { repositories { jcenter() maven { url "$rootDir/node_modules/react-native/android" } } }

根目录gradle配置maven

原生Android应用嵌入RN教程参考官网

http://reactnative.cn/docs/0.46/integration-with-existing-apps.html#content

转载请注明原文地址: https://www.6miu.com/read-46176.html

最新回复(0)