React Native踩坑记录

1.无法将“adb”项识别为 cmdlet、函数、脚本文件或可运行程序的名称。请检查名称的拼写,如果包括路径,请确保路径正确,然后再试一次。

解决方法: 按照官网配置环境变量(注: 一定要关掉cmd重新打开才生效, vscode要整个关掉重新打开)


2. Looks like you installed react-native globally, maybe you meant react-native-cli?
To fix the issue, run:
npm uninstall -g react-native
npm install -g react-native-cli

解决方法: 执行提示的安装方法不好用, 使用npm install --save-dev react-native-cli


3.JAVA_HOME is not set and no 'java' command could be found in your PATH

解决办法: 配置环境变量
    1). 变量名:classpath 值:.;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar; 注意变量值中,前面的“点“和”分号”,可以直接复制此变量值。然后点击“确定”。)
    2).变量名:JAVA_HOME 值:C:\Program Files\Java\jdk1.8.0_221\(你的安装目录)

    3)变量名: path, 值: 增加%JAVA_HOME%\bin和%JAVA_HOME%\jre\bin


4.Exception in thread "main" java.lang.RuntimeException: Timeout of 120000 reached waiting for exclusive access to file:

解决方法, 文件缺失, 下载地址:http://services.gradle.org/distributions/ 


5.Could not determine java version from '14.0.1'

解决方法: jdk版本与gradle版本不匹配, 降低jdk版本, 或者升级gradle版本, 地址同上


6.Could not initialize class org.codehaus.groovy.reflection.ReflectionCache

解决方法: jdk版本与gradle版本不匹配, 降低jdk版本, 或者升级gradle版本, 地址同上


7.

解决方法: 路径有中文, 改成英文


8.A problem occurred configuring project ':app'.
> Failed to notify project evaluation listener.
   > javax/xml/bind/annotation/XmlSchema

解决方法: 没解决, 妥协了, 把jdk版本降低了

 


9. Could not resolve all files for configuration ':classpath'


10. Connect to maven.google.com:443 [maven.google.com/172.217.160.110] failed: Connection timed out: connect

解决方法: 把google() 和 jcenter()替换为

        maven { url 'https://maven.aliyun.com/repository/google' }

        maven { url 'https://maven.aliyun.com/repository/jcenter' }


11. 找不到 raw.githubusercontent.com 的服务器 IP 地址

在C:\Windows\System32\drivers\etc路径下找到hosts文件

添加199.232.68.133 raw.githubusercontent.com


12.ould not resolve all task dependencies for configuration ':app:debugCompileClasspath'.
   > Could not resolve project :react-native-interactable.
     Required by:
         project :app
      > Unable to find a matching configuration of project :react-native-interactable: None of the consumable configurations have attributes.

解决方法: 将settings.gradle文件中

project(':react-native-interactable').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-interactable/android')

改为

project(':react-native-interactable').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-interactable/lib/android')


13.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值