react-native错误集锦
1.react-native run-android报错
Could not install the app on the device, read the error above for details. Make sure you have an Android emulator running or a device connected and have set up your Android development environment: https://facebook.github.io/react-native/docs/android-setup.html
1.确认模拟器是否启动
2.模拟器状态是否正常
3.真机是否连接好
下图为模拟器正常状态

下图就是错误状态

2.SyntaxError /user/Destop/xxxx.js:Unexpected token(80:8)
报错信息

报错代码:

原因:多了一个 > 号,这种报错一般需要自己检查一下代码,一般可能是多了一个
: } >
3.CFBundle identifier xxnot found
网络不好的情况下,rncash包没有下载好,建议多试几次
4.application has not been registered
1.:MainActivity.java
检查的项目名称与index.android.js
文件里的项目名称是否相同
2:是否同时开启了两个项目
5.:unable to load script from assets 'index.android bundle' ,make sure your bundle is packaged correctly or youu're runing a packager server
错误如下图:

修改方法:

在终端进入到当前文件目录下,输入:
1.mkdir android/app/src/main/assets
(如果提示:mkdir: android/app/src/main/assets: File exists
可直接执行第二步)
2.react-native bundle --platform android --dev false --entry-file index.android.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res
6.SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable.
在当前文件夹下查看是否有local.properties
这个文件,如果没有就创建一个
下图示例:

7. A problem occurred configuring project ':app'. > failed to find Build Tools revision 23.0.1
当我在终端react-native run-android
时报了上述错误,修改方法为:进入到android/app/build.gradle
将buildToolsVersion
改成所提示版本
下图为正确示例:

8.no bundle URL present
请检查是否打开了两个项目/模拟器,先全部退出,在再终端输入:react-native run-ios
报错如图:

9.Super expression must either be null or a function
这种一般是代码写错了,需要仔细检查自己的代码,错误图例如下
