【发布时间】:2019-05-11 22:04:04
【问题描述】:
我一个星期没碰我的项目,但是当我回来在android模拟器上运行项目时突然出现这个错误
* What went wrong:
A problem occurred configuring project ':react-native-image-picker'.
> Could not resolve all files for configuration ':react-native-image-picker:classpath'.
> Could not find any matches for com.android.tools.build:gradle:2.2.+ 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-image-picker
我的 build.gradle
buildscript {
repositories {
jcenter()
google()
mavenLocal()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
mavenLocal()
jcenter()
maven { url "https://jitpack.io" }
maven { url "https://maven.google.com" }
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
}
}
我在 stackoverflow 上搜索了一段时间,但找不到解决方案。任何帮助表示赞赏。
【问题讨论】:
-
您正在查看错误的 gradle 文件。寻找具有
2.2.+的那个。也许在app文件夹下查看。如果找到,请将其更改为2.1.2。由于某种原因,我今天遇到了同样的问题。
标签: android android-studio react-native