有关react-native安卓配置react-native-vector-icons图标报错问题

本文解决在React Native项目中使用vector图标包时遇到的配置错误,包括过时的依赖配置和资源下载超时问题,通过更新配置和同步buildToolsVersion解决。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

npm上的配置说明链接https://www.npmjs.com/package/react-native-vector-icons

1.按照上面文档的配置还是会报错 说明这个文档没有及时更新,
下面是报错第一个错:

Configure project :app
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html

上面的错误是说安卓的依赖项已经废弃了compile 该使用implementation
2.报的第二个错误:

What went wrong:
A problem occurred configuring project ':react-native-vector-icons'.
> Could not resolve all artifacts for configuration ':react-native-vector-icons:classpath'.
   > Could not download jsr305.jar (com.google.code.findbugs:jsr305:1.3.9)
      > Could not get resource 'https://jcenter.bintray.com/com/google/code/findbugs/jsr305/1.3.9/jsr305-1.3.9.jar'.
         > Read timed out
   > Could not download commons-logging.jar (commons-logging:commons-logging:1.1.1)
      > Could not get resource 'https://jcenter.bintray.com/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar'.
         > Read timed out

因为node_module中的react-native-vector-icons下的 buildToolsVersion 和你项目的 buildToolsVersion 不一致,所以你需要修改react-native-vector-icons中的buildToolsVersion 和项目中的一致 如下图:
在这里插入图片描述
在这里插入图片描述
配置就完成了重新react-native run-android编译文件启动模拟器不报错就没事了

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值