問題描述
我正在開發(fā)一個(gè)應(yīng)用程序.在我的應(yīng)用程序中,代碼沒有錯(cuò)誤,但是當(dāng)我嘗試運(yùn)行我的項(xiàng)目時(shí),它會(huì)出現(xiàn)以下錯(cuò)誤.
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.
錯(cuò)誤:(1, 1) 評(píng)估項(xiàng)目 ':app' 時(shí)出現(xiàn)問題.
Error:(1, 1) A problem occurred evaluating project ':app'.
無法應(yīng)用插件 [id 'com.android.application']
Failed to apply plugin [id 'com.android.application']
無法創(chuàng)建AppPlugin"類型的插件.
Could not create plugin of type 'AppPlugin'.
我也試試這個(gè) Gradle發(fā)出錯(cuò)誤無法創(chuàng)建AppPlugin"類型的插件"
這也是 Android Studio 中的 Gradle 錯(cuò)誤
以下是我的 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
版本來解決這個(gè)問題.
You need to update to the latest gradle
version to solve this issue.
請(qǐng)確保您使用的是最新的 Android Studio
Please make sure you are on the latest Android Studio
然后通過更新這個(gè)依賴來更新你的項(xiàng)目級(jí)別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'
}
}
它可能會(huì)顯示一個(gè)彈出窗口詢問您是否允許更新 gradle
,請(qǐng)更新它會(huì)自動(dòng)下載最新的發(fā)行版,問題將得到解決.
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 并添加手動(dòng)的
Get Latest Gradle 5.6.4 from here and Add it manually
如果您不想手動(dòng)下載:
打開你的項(xiàng)目>畢業(yè)>包裝器>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
重建項(xiàng)目或再次運(yùn)行 gradle sync.
Rebuild the project or just run gradle sync again.
這篇關(guān)于Android Studio - 無法應(yīng)用插件 [id 'com.android.application']的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!