android - 找不到 com.android.tools.build :gradle:3. 5

标签 android react-native

我正在尝试将 gradle 从 1.3.1 更新到 3.5,因为我的一些依赖项需要 3.3 或更高版本。

我见过类似的问题,但没有一个有帮助。

build.gradle :

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.5'
    }
}

gradle-wrapper.properties :
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-3.5-all.zip

当我尝试做任何事情(构建,清理等)时,我仍然得到这个:
Building and installing the app on the device (cd android && ./gradlew installDebug...

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'chat'.
> Could not resolve all dependencies for configuration ':classpath'.
   > Could not find com.android.tools.build:gradle:3.5.
     Searched in the following locations:
         https://jcenter.bintray.com/com/android/tools/build/gradle/3.5/gradle-3.5.pom
         https://jcenter.bintray.com/com/android/tools/build/gradle/3.5/gradle-3.5.jar
     Required by:
         project :

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

最佳答案

要解决此问题,请检查您是否拥有 谷歌() repo 您的项目级别 build.gradle 文件。

buildscript {
    repositories {
        jcenter()
        google() //HAVE YOU MISS IT?
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.5.0'
    }
}

allprojects {
    repositories {
        jcenter()
        google() //HAVE YOU MISS IT?
    }
}

关于android - 找不到 com.android.tools.build :gradle:3. 5,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43497280/

相关文章:

android - 如何使用嵌套的挂起函数对 kotlin 协程进行单元测试

android - 改造 - 更改 BaseUrl

android - 如何为 Android 创建通用 JSON 解析器

javascript - 了解 React Native 跨平台

ios - 尝试安装 react native 时出错,运行 pod install 时无法正确构建

android - 在 android 上设置 Google maps API v2,错误膨胀类 fragment

android - EditText 意外行为

javascript - 创建 React Native 应用程序时出错 : Element type is invalid: expected a string or a class/function but got: object

css - react native : trying to hide search bar on scroll

javascript - 无法将图片上传到 Firebase