尝试react-native run-android时出错。我不知道为什么会出错。
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugApk'.
> A problem occurred configuring project ':react-native-vector-icons'.
> Could not resolve all dependencies 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.
android\build.gradle的配置文件如下所示。
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
mavenLocal()
jcenter()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is
installed from npm
url "$rootDir/../node_modules/react-native/android"
}
}
}
Gradle版本:3.3,插件:2.2.3
2条答案
按热度按时间wkftcu5l1#
1.升级package.json中的
react-native-vector-icons: "^6.0.2"
1.然后运行
npm i react-native-vector-icons
1.作为最后一步,
cd android && ./gradlew clean
。lmvvr0a82#
依赖项更改自:
第一个月
致:
dependencies { compile "com.facebook.react:react-native:${safeExtGet('reactNativeVersion', '+')}" }
同时更改构建脚本依赖项以使用:
classpath 'com.android.tools.build:gradle:2.2.3'
和maven { url "https://dl.bintray.com/android/android-tools/" }
,而不是google()
因此,您的../node_modules/react-native-vector-icons/android/build. gradle应该如下所示: