问题描述
这是我第一次尝试 Android Studio.我安装了 0.8.0 并更新到 0.8.2.一旦创建了项目,我就会收到错误消息:
This is my first attempt at Android Studio. I installed 0.8.0 and updated to 0.8.2. As soon as a project is created I get the error message:
错误:(1, 0) 未找到 ID 为com.android.application"的插件
C:UsersBobAndroidStudioProjectsHelloAgain6appuild.gradle
C:UsersBobAndroidStudioProjectsHelloAgain6appuild.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 20
buildToolsVersion "20.0.0"
defaultConfig {
applicationId "com.example.bob.helloagain6"
minSdkVersion 15
targetSdkVersion 20
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
}
和 C:UsersBobAndroidStudioProjectsHelloAgain6uild.gradle
and C:UsersBobAndroidStudioProjectsHelloAgain6uild.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.12.+'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
推荐答案
更新答案(2020 年 12 月 2 日)
最新 Gradle: 6.5
版本检查:
./gradlew -v
如何更新:
- 设置网址:
./gradlew wrapper --gradle-version=6.5 --distribution-type=all
- 更新:
./gradlew 包装器
最新的 Android Gradle 插件: 4.1.0
如果您将以下代码片段添加到 build.gradle
文件的顶部.Gradle 将更新构建工具.
If you add the following code snippet to the top of your build.gradle
file. Gradle will update the build tools.
buildscript {
repositories {
google() // For Gradle 4.0+
maven { url 'https://maven.google.com' } // For Gradle < 4.0
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.0'
}
}
在此处阅读更多信息:https://developer.android.com/studio/build/index.html 以及这里的版本兼容性:https://developer.android.com/studio/releases/gradle-plugin.html#updating-gradle 和 https://dl.google.com/dl/android/maven2/index.html.
Read more here: https://developer.android.com/studio/build/index.html and about version compatibility here: https://developer.android.com/studio/releases/gradle-plugin.html#updating-gradle and https://dl.google.com/dl/android/maven2/index.html.
我遇到了同样的错误,您需要确保您的 Gradle 版本与您的 Android Gradle 插件兼容.
I had this same error, you need to make sure your Gradle version is compatible with your Android Gradle Plugin.
最新版本的 Gradle 是 2.0,但您需要使用 1.12 才能使用 Android Gradle 插件.
The latest version of Gradle is 2.0 but you need to use 1.12 in order to use the Android Gradle Plugin.
这篇关于错误:(1, 0) 未找到 ID 为“com.android.application"的插件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!