我正在开发一个应用程序.在我的应用程序中,代码没有错误,但是当我尝试运行我的项目时,它会出现以下错误.
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']的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!
更新到 Android Build Tools 25.1.6 GCM/FCM 后出现 IncompIncompatibleClassChangeError after updating to Android Build Tools 25.1.6 GCM / FCM(更新到 Android Build Tools 25.1.6 GCM/FCM 后出现 Incompatible
如何在 gradle 中获取当前风味How to get current flavor in gradle(如何在 gradle 中获取当前风味)
如何修复“意外元素<查询>在“清单How to fix quot;unexpected element lt;queriesgt; found in lt;manifestgt;quot; error?(如何修复“意外元素lt;查询gt;在“清单中找到错误
基于 Android Gradle 中多风味库的多风味应用Multi flavor app based on multi flavor library in Android Gradle(基于 Android Gradle 中多风味库的多风味应用)
Android 依赖在编译和运行时有不同的版本Android dependency has different version for the compile and runtime(Android 依赖在编译和运行时有不同的版本)
本地 aar 库的传递依赖Transitive dependencies for local aar library(本地 aar 库的传递依赖)