問題描述
我正在開發(fā)一個應(yīng)用程序.在我的應(yīng)用程序中,代碼沒有錯誤,但是當(dāng)我嘗試運行我的項目時,它會出現(xiàn)以下錯誤.
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' 時出現(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'.
我也試試這個 Gradle發(fā)出錯誤無法創(chuàng)建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
,請更新它會自動下載最新的發(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 并添加手動的
Get Latest Gradle 5.6.4 from here and Add it manually
如果您不想手動下載:
打開你的項目>畢業(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
重建項目或再次運行 gradle sync.
Rebuild the project or just run gradle sync again.
這篇關(guān)于Android Studio - 無法應(yīng)用插件 [id 'com.android.application']的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!