如何解决找不到 com.android.tools.build:gradle:4.1.1.?

时间:2021-02-10 13:42:48

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

无法在 android studio 中构建 React Native 应用程序。 我试过了:

  1. 将项目与 Gradle 文件同步,但由于 错误
  2. 文件 -> 使缓存无效/重新启动
  3. 从 $HOME/.gradle 清除缓存
  4. 删除 $HOME/.gradle
  5. 在 2.3.0 上更改 com.android.tools.build:gradle 版本,因为它是 此列表中的最新版本 (Azure IoT team),但是当我使用 npx react-native init projectName 时,使用的是 Android 插件版本 4.1.2,但此版本不在此列表中。 也知道Gradle的区别,Android Gradle Plugin, Gradle Wrapper,已阅读https://repo.jfrog.org/artifactory/libs-release-bintray/com/android/tools/build/gradle/。我尝试使用最新的 Gradle v. 6.8.2 和 Android Gradle Plugin v. 4.1.2,它也没有帮助构建项目。
  6. distributionUrl 更改为 项目名称/android/gradle/wrapper/gradle-wrapper.properties
  7. 更改文件->设置->构建、执行、部署->Gradle使用 Gradle from Specified location 并设置 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 版本 6.5

  • Android Gradle 插件 v. 4.1.2

  • gradle-wrapper 6.5-all

  • Android Studio 4.1.2

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

1 个答案:

答案 0 :(得分:0)

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

相关问题