gpt4 book ai didi

android - 错误 :(1, 0) 未找到 ID 为 'com.android.application' 的插件

转载 作者:IT老高 更新时间:2023-10-28 12:50:47 24 4
gpt4 key购买 nike

这是我第一次尝试 Android Studio。我安装了 0.8.0 并更新到 0.8.2。一旦创建项目,我就会收到错误消息:

Error:(1, 0) Plugin with id 'com.android.application' not found

C:\Users\Bob\AndroidStudioProjects\HelloAgain6\app\build.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:\Users\Bob\AndroidStudioProjects\HelloAgain6\build.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 wrapper

最新的 Android Gradle 插件: 4.1.0

如果您将以下代码 fragment 添加到 build.gradle 文件的顶部。 Gradle 将更新构建工具。

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-gradlehttps://dl.google.com/dl/android/maven2/index.html .

原答案

我遇到了同样的错误,您需要确保您的 Gradle 版本与您的 Android Gradle 插件兼容。

Gradle 的最新版本是 2.0,但您需要使用 1.12 才能使用 Android Gradle 插件。

关于android - 错误 :(1, 0) 未找到 ID 为 'com.android.application' 的插件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24795079/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com