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。将主项目的版本提升,至少比引用的库文件版本要更高

相关文章
相关标签/搜索