Android 原生應用嵌入React-Native模組開發-環境配置及填坑記
阿新 • • 發佈:2019-02-09
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'
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教程參考官網