我在本机项目中已经使用了矢量图标,虽然做得很好,但是在为Android平台进行构建(react-native run-android)几个小时之前,我得到了这个错误。
执行以下步骤来添加矢量图标:
npm install react-native-vector-icons –保存
本机链接
任何人都可以帮助解决此问题吗?
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':react-native-vector-icons'.
> Could not resolve all files for configuration ':react-native-vector-icons:classpath'.
> Could not find any matches for com.android.tools.build:gradle:2.3.+ as no versions of com.android.tools.build:gradle are available.
Searched in the following locations:
https://jcenter.bintray.com/com/android/tools/build/gradle/maven-metadata.xml
https://jcenter.bintray.com/com/android/tools/build/gradle/
Required by:
project :react-native-vector-icons
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 7s
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/getting-started.html
答案 0 :(得分:0)
将此添加到build.gradle 这些问题是因为这些软件包发布了一段时间。 它可以解决图像选择器和矢量图标的问题
subprojects {
if (project.name.contains('react-native-image-picker') ||
project.name.contains('react-native-vector-icons')) {
buildscript {
repositories {
jcenter()
maven { url "https://dl.bintray.com/android/android-tools/" }
}
}
}
}