Android Studio:找不到匹配项,因为没有com.Android.tools.build:gradle的版本可用
我正在尝试构建一个使用React Native创建的Android应用程序,我最近克隆了该应用程序,但我总是遇到以下错误:Android Studio:找不到匹配项,因为没有com.Android.tools.build:gradle的版本可用,android,react-native,android-gradle-plugin,build.gradle,Android,React Native,Android Gradle Plugin,Build.gradle,我正在尝试构建一个使用React Native创建的Android应用程序,我最近克隆了该应用程序,但我总是遇到以下错误: 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://jcente
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
我已经打开了那些URL,但工件不在那里。。。所以我不知道该怎么办
这是我的/myproject/android/build.gradle:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
//classpath 'com.android.tools.build:gradle:2.3.3' //This doesn't work either
classpath 'com.android.tools.build:gradle:3.1.0'
classpath 'com.google.gms:google-services:3.0.0' // new add for FCM
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
mavenLocal()
google()
jcenter()
mavenCentral()
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
}
ext {
compileSdkVersion = 26
buildToolsVersion = "27.0.2"
minSdkVersion = 16
targetSdkVersion = 26
}
这是我的/myproject/android/app/build.gradle
应用插件:“com.android.application”
这就是我的项目设置的方式:
是的,谷歌删除了一些gradle谷歌服务。
请等待他们解决此问题。升级到react native image picker 0.27.2的最新版本,问题已在那里得到解决我也遇到过同样的问题,但库仍在引发问题,我解决问题的方法是更改节点模块的build.gradle文件 ./node_modules/react native image picker/android/build.gradle
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.4'
}
}
尝试类似的方法,将项目名称替换为您自己的项目名称npm install react native image picker将解决此问题。
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.4'
}
}
subprojects {
if (project.name.contains('react-native-image-picker')) {
buildscript {
repositories {
jcenter()
maven { url "https://dl.bintray.com/android/android-tools/" }
}
}
}
}