【问题标题】:How to solve Could not find com.android.tools.build:gradle:4.1.1.?如何解决找不到com.android.tools.build:gradle:4.1.1.?
【发布时间】:2021-05-14 05:02:24
【问题描述】:

无法在 android studio 中构建 react 原生应用。 我试过了:

  1. 使用 Gradle 文件同步项目,但我不能这样做,因为 错误
  2. 文件 -> 使缓存无效/重新启动
  3. 从 $HOME/.gradle 清除缓存
  4. 删除$HOME/.gradle
  5. 在 2.3.0 上更改 com.android.tools.build:gradle 版本,因为它是 此列表中的最新版本 (https://repo.jfrog.org/artifactory/libs-release-bintray/com/android/tools/build/gradle/),但是当我使用npx react-native init projectName 时,使用的是 Android 插件版本 4.1.2,但此列表中没有此版本。 也知道 Gradle、Android Gradle Plugin 的区别, Gradle Wrapper,已阅读 https://developer.android.google.cn/studio/releases/gradle-plugin?hl=en。我尝试使用最新的 Gradle v. 6.8.2 和 Android Gradle Plugin v. 4.1.2,也没有帮助构建项目。
  6. 更改distributionUrl 项目名称/android/gradle/wrapper/gradle-wrapper.properties
  7. 更改文件->设置->构建、执行、部署->Gradle 使用 从指定位置 Gradle 并设置 C:/Gradle/gradle-6.8.2,它没有帮助并将其保留为默认值 我知道在 stackoverflow 和 github 上有完全相同的问题,但解决方案没有帮助。

构建输出:

Could not find com.android.tools.build:gradle:4.1.1.
Searched in the following locations:
  - https://jcenter.bintray.com/com/android/tools/build/gradle/4.1.1/gradle-4.1.1.pom
If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
Required by:
    project :react-native-settings
Add google Maven repository and sync project
Open File

现在使用:

  • Gradle v. 6.5

  • Android Gradle 插件 v. 4.1.2

  • gradle-wrapper 6.5-all

  • Android Studios 4.1.2

  • Android SDK 平台:Android 10、9、8.1、8.0、7.1.1、7.0

【问题讨论】:

    标签: react-native android-studio gradle android-gradle-plugin build.gradle


    【解决方案1】:

    您的 google Maven 库丢失。添加后重建项目

    【讨论】:

      猜你喜欢
      • 2021-03-12
      • 2021-03-30
      • 1970-01-01
      • 2021-12-16
      • 2019-05-12
      • 2019-11-06
      • 2019-12-27
      • 2020-02-08
      • 2017-04-11
      相关资源
      最近更新 更多