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.真机是否连接好
下图为模拟器正常状态
Simona_Test1
下图就是错误状态
Simona_Test2

2.SyntaxError /user/Destop/xxxx.js:Unexpected token(80:8)

报错信息
Simona_Test3
报错代码:
Simona_Test4
原因:多了一个 > 号,这种报错一般需要自己检查一下代码,一般可能是多了一个 : } >

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

错误如下图:
Simona_Test5

修改方法:

Simona_Test6

在终端进入到当前文件目录下,输入:
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这个文件,如果没有就创建一个
下图示例:
Simona_Test7

7. A problem occurred configuring project ‘:app’. > failed to find Build Tools revision 23.0.1

当我在终端react-native run-android时报了上述错误,修改方法为:进入到android/app/build.gradlebuildToolsVersion改成所提示版本
下图为正确示例:
Simona_Test8

8.no bundle URL present

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

9.Super expression must either be null or a function

这种一般是代码写错了,需要仔细检查自己的代码,错误图例如下
Simona_Test10.png

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值