gpt4 book ai didi

android - Android Studio 中缺少 com.android.tools.build.gradle4.1

转载 作者:太空狗 更新时间:2023-10-29 16:26:49 25 4
gpt4 key购买 nike

这是我的 build.gradle 文件:

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {

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


// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}

allprojects {
repositories {
jcenter()
google()
}
}

task clean(type: Delete) {
delete rootProject.buildDir
}

这里是 gradle-wrapper:

#Fri Jan 12 02:39:29 EST 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4.1-all.zip

完整的错误跟踪在这里:

Error:FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'CryptoGallery'.
> Could not resolve all files for configuration ':classpath'.
> Could not find com.android.tools.build:gradle:4.1.
Searched in the following locations:
file:/home/xavi/android-studio/gradle/m2repository/com/android/tools/build/gradle/4.1/gradle-4.1.pom
file:/home/xavi/android-studio/gradle/m2repository/com/android/tools/build/gradle/4.1/gradle-4.1.jar
https://jcenter.bintray.com/com/android/tools/build/gradle/4.1/gradle-4.1.pom
https://jcenter.bintray.com/com/android/tools/build/gradle/4.1/gradle-4.1.jar
https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/4.1/gradle-4.1.pom
https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/4.1/gradle-4.1.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. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 0s

我查看了目录 /home/xavi/android-studio/gradle/m2repository/com/android/tools/build/gradle/4.1/ 并看到我 有一个 gradle 4.1 构建,但它不像其他的那样包含一个简单的 .jar。这是从官方 gradle 网站下载的完整内容。它包含许多可执行文件,但没有像其他文件那样标记为 gradle-4.1.jar

编辑:将 classpath 更改为正确的行后,android studio 提示我将 gralde 更新到 4.4.1,并且我得到了回溯。

最佳答案

不要将 gradle 与 gradle 的 androd 插件 混淆。

改变:

classpath 'com.android.tools.build:gradle:4.1'

与:

 classpath 'com.android.tools.build:gradle:3.0.1'

更多信息 here .

关于android - Android Studio 中缺少 com.android.tools.build.gradle4.1,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48222047/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com