ReactNative常見錯誤

1. java.util.concurrent.ExecutionException:java.lang.RuntimeException:ReferenceError:Can't find variable:__fbBatchedBride或者Couldn‘t get the native call queue:bridge configuration isn't available

解決辦法:adb reverse tcp:8081 tcp:8081java

2.Android模擬器調不出Menu菜單

按兩下R鍵,或者按crtl+Mnode

3.React Native紅屏500錯誤解決辦法

關掉node後臺進程,用npm start -- --reset-cache命令從新啓動packager服務react

4.TypeError: Cannot read property 'bindings' of null

When upgrading to 0.56, make sure to bump your babel-preset-react-native package.json dependency to ^5.0.1 or newer.android

babel-preset-react-native更新到最新,例如:ios

{
    "babel-jest": "23.4.0",
    "babel-preset-react-native": "5.0.2",
    "jest": "23.4.1",
    "react-test-renderer": "16.4.1"
}
複製代碼

5.看不到日誌

1)Android下npm

#react-native log-androidjson

2)Ios下react-native

#react-native log-iosbash

6.androidx錯誤

直接刪除androidx相關引用,用其餘代替。好比 import androidx.annotation.Nullable替換爲import android.support.annotation.Nullablebabel

7.引用了太多原生項目,編譯錯誤

What went wrong: Execution failed for task ':app:processDebugResources'.

Failed to process resources, see aapt output above for details

有多是版本不一致,好比庫文件compileSdkVersion=28,而主項目appcompileSdkVersion=27。將主項目的版本提升,至少比引用的庫文件版本要更高

相關文章
相關標籤/搜索