Android Studio - 无法应用插件 [id 'com.android.application'] [英] Android Studio - Failed to apply plugin [id 'com.android.application']

查看:86
本文介绍了Android Studio - 无法应用插件 [id 'com.android.application']的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个应用程序.在我的应用程序中,代码没有错误,但是当我尝试运行我的项目时,它会出现以下错误.

I am working on an app. In my app there is no error in code but when I try to run my project it gives following errors.

错误:(1, 1) 评估项目 ':app' 时出现问题.

Error:(1, 1) A problem occurred evaluating project ':app'.

无法应用插件 [id 'com.android.application']

Failed to apply plugin [id 'com.android.application']

无法创建AppPlugin"类型的插件.

Could not create plugin of type 'AppPlugin'.

我也试试这个 Gradle发出错误无法创建AppPlugin"类型的插件"

这也是 Android Studio 中的 Gradle 错误

以下是我的 build.gradle 文件

apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'

android {

    compileSdkVersion 23
    buildToolsVersion "21.1.2"

    defaultConfig {
        applicationId "com.praval.healthfreak"
        minSdkVersion 15
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}
dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'

    compile 'com.android.support:appcompat-v7:23.2.1'
    compile 'com.google.android.gms:play-services:8.3.0'
    compile 'de.hdodenhof:circleimageview:1.3.0'
    compile 'com.android.support:design:23.2.1'
    compile files('libs/YouTubeAndroidPlayerApi.jar')

}

推荐答案

2020 年 6 月 24 日更新

您需要更新到最新的 gradle 版本来解决这个问题.

You need to update to the latest gradle version to solve this issue.

请确保您使用的是最新的 Android Studio

Please make sure you are on the latest Android Studio

然后通过更新这个依赖来更新你的项目级别build.gradle

and then update your project level build.gradle by updating this dependency

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

它可能会显示一个弹出窗口询问您是否允许更新 gradle,请更新它会自动下载最新的发行版,问题将得到解决.

It might show a popup asking your permission to update gradle, please update and it will download the latest distribution automatically and the issue will be resolved.

否则你可以

此处获取最新的 Gradle 5.6.4 并添加手动的

Get Latest Gradle 5.6.4 from here and Add it manually

如果您不想手动下载:

打开你的项目>毕业>包装器>gradle-wrapper.properties 并替换

distributionUrl=https://services.gradle.org/distributions/gradle-version-number-all.zip

distributionUrl=https://services.gradle.org/distributions/gradle-6.1.1-all.zip

重建项目或再次运行 gradle sync.

Rebuild the project or just run gradle sync again.

这篇关于Android Studio - 无法应用插件 [id 'com.android.application']的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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