找不到com.android.tools.build:gradle:2.2.3

时间:2018-12-11 08:57:32

标签: android react-native gradle

我正在构建一个本机应用程序,并且正在使用react-native-gallery-manager库。

没有它,它可以正常工作,但是有了它,我得到以下错误:

  

*出了什么问题:

     

配置项目':react-native-gallery-manager'时出现问题。
  无法解析配置':react-native-gallery-manager:classpath'的所有工件。
  找不到com.android.tools.build:gradle:2.2.3。        在以下位置搜索:            https://jcenter.bintray.com/com/android/tools/build/gradle/2.2.3/gradle-2.2.3.pom            https://jcenter.bintray.com/com/android/tools/build/gradle/2.2.3/gradle-2.2.3.jar
       要求:            项目:react-native-gallery-manager

在我的android / build.gradle中,我的buildscript中包含以下内容:

repositories {
    google()
    jcenter()
    maven { url 'https://plugins.gradle.org/m2/' }
}
dependencies {
    classpath 'com.android.tools.build:gradle:3.2.1'
}

这是否意味着我必须降级gradle版本?

2 个答案:

答案 0 :(得分:2)

在您要讨论的库将解决此问题之前,将此代码添加到build.gradle

subprojects {
    if (project.name.contains('react-native-gallery-manager')) {
        buildscript {
            repositories {
                jcenter()
                maven { url "https://dl.bintray.com/android/android-tools/"  }
            }
        }
    }
}

所有有问题的库也是如此...目前正在更新许多存储库以修复该问题。

答案 1 :(得分:0)

您必须更改

./ node_modules / react-native-gallery-manager / android / build.gradle

    buildscript {
      repositories {
        google()
        jcenter()
      }

    dependencies {
      classpath 'com.android.tools.build:gradle:3.1.4'
    }
   }