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编译文件启动模拟器不报错就没事了