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

查看:1971
本文介绍了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中的分级错误

以下是我的 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

如果您不想手动下载它:

打开YourProject > gradle > wrapper > 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天全站免登陆