我将Android Studio更新到最新版本(3.6.1),现在找不到Gradle插件 [英] I updated the Android Studio to the latest version (3.6.1) and Gradle Plugin is not found now

查看:71
本文介绍了我将Android Studio更新到最新版本(3.6.1),现在找不到Gradle插件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Android应用程序中,
我将Android Studio更新到了最新版本(3.6.1)

In an Android application,
I updated the Android Studio to the latest version (3.6.1)

现在,在同步Gradle时,找不到Gradle插件,并显示以下错误:

Now when Syncing Gradle, the Gradle Plugin is not found with the errors as following:

起因:org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration $ ArtifactResolveException:无法解析配置':classpath'的所有文件.

Caused by: org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration$ArtifactResolveException: Could not resolve all files for configuration ':classpath'.

还有

原因:org.gradle.internal.resolve.ModuleVersionNotFoundException:找不到com.android.tools.build:gradle:3.0.0.

Caused by: org.gradle.internal.resolve.ModuleVersionNotFoundException: Could not find com.android.tools.build:gradle:3.0.0.

这让我发疯,因为我将Gradle版本和Gradle插件版本更改为其他几种可能性,但再次找不到Gradle插件,并且出现了相同的错误

It's driving me crazy cause I change the Gradle Version and Gradle Plugin Version to several other possibilities but again the Gradle Plugin is not found with the same error

Build.Gradle文件:

Build.Gradle file:

// 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:3.0.0'
    }
}

allprojects {
    repositories {
        jcenter()
        google()
        maven { url "https://jitpack.io" }
    }
}

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

和Gradle.Wrappers.Properties文件:

And Gradle.Wrappers.Properties file:

#Thu Mar 05 15:41:52 IRST 2020
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip


我也添加了以下数据:

Edit :
I added the following data too:

编译SDK版本:25
生成工具版本:25.0.3

Compile Sdk version: 25
Build Tools Version: 25.0.3

推荐答案

这对我有用:

从您的应用文件夹中打开 build.gradle 文件,该文件看起来应与此类似

Open the build.gradle file from your app folder, it should look similar to this

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

allprojects {
    repositories {
        jcenter()
    }
}

google()添加到- buildscript和所有项目中的存储库中,就像这样:

add google() to repositories in -buildscript and allprojects just like this :

buildscript {
    repositories {
        google()       // here
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.6.1'
    }
}

allprojects {
    repositories {
        google()      //and here
        jcenter()
    }
}

在Android Studio中,转到文件-> 项目结构. [快捷方式: Ctrl + Alt + Shift + S ]

In Android Studio, go to File -> Project Structure.. [ shortcut : Ctrl + Alt + Shift + S ]

项目 标签中-> Android Gradle插件版本-> 3.6.1 Gradle版本-> 5.6.4 |||

In the Project tab -> Android Gradle Plugin Version -> 3.6.1 and Gradle Version -> 5.6.4 |||

最后,请确保在 模块 标签下,编译sdk版本为> 14(即:25、28或29 ..)

Last, under the Module tab, make sure the compile sdk version is > 14 (ie: 25, 28 or 29..)

这篇关于我将Android Studio更新到最新版本(3.6.1),现在找不到Gradle插件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆