Android Studio 错误:(8, 0) 未找到 ID 为“android”的插件
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/24298896/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Android Studio Error: (8, 0) Plugin with id 'android' not found
提问by user927584
I have installed Android Studio (0.6.1) on OS X (10.9.3) and Gradle 1.1 using Brew (brew install gradle). However, I can't get my first Hello World! project... Please help me solve this issue
我已经使用 Brew (brew install gradle) 在 OS X (10.9.3) 和 Gradle 1.1 上安装了 Android Studio (0.6.1)。但是,我无法获得我的第一个 Hello World!项目...请帮我解决这个问题
build.gradle:
构建.gradle:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.11.+'
}
}
apply plugin: 'android'
repositories {
mavenCentral()
}
android {
compileSdkVersion 19
buildToolsVersion '19.1'
defaultConfig {}
productFlavors {}
}
dependencies {
}
Error message:
错误信息:
Error:(8, 0) Plugin with id 'android' not found.
错误:(8, 0) 未找到 ID 为“android”的插件。
Getting Build failed with an Exception Android Studio 0.4.3 and 0.4.4post and Android Studio: Plugin with id 'android-library' not foundpost does not solves the problem...
Get Build failed with an Exception Android Studio 0.4.3 and 0.4.4post and Android Studio: Plugin with id 'android-library' not foundpost 不能解决问题...
Second post I linkedreturns this error message:
我链接的第二篇文章返回此错误消息:
Error:The project is using an unsupported version of Gradle. Please use version 1.10. Please point to a supported Gradle version in the project's Gradle settings or in the project's Gradle wrapper (if applicable.) Fix Gradle wrapper and re-import project Gradle settings
错误:项目正在使用不受支持的 Gradle 版本。请使用 1.10 版。请在项目的 Gradle 设置或项目的 Gradle 包装器(如果适用)中指向受支持的 Gradle 版本。修复 Gradle 包装器并重新导入项目 Gradle 设置
回答by pyus13
It seems you have missed to add android gradle plugin dependency in dependencies
block.
似乎您错过了在dependencies
块中添加 android gradle 插件依赖项。
Replace the top buildScript
section by this and sync your project with gradle
用buildScript
此替换顶部并将您的项目与 gradle 同步
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.11.+'
}
}
apply plugin: 'android'
android {
compileSdkVersion 19
buildToolsVersion '19.1.0'
defaultConfig {
applicationId 'YOUR_APP_PACKAGE'
minSdkVersion 9
targetSdkVersion 17
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
productFlavors { }
}
dependencies {
}
回答by sherin
build.gradle file inside my "app" folder: PATH: /home/work/ProjectName/app/build.gradle
我的“app”文件夹中的 build.gradle 文件:路径:/home/work/ProjectName/app/build.gradle
android {
compileSdkVersion 19
buildToolsVersion '19.1.0'
defaultConfig {
minSdkVersion 11
targetSdkVersion 19
versionCode 1
versionName '1.0'
}
dependencies {
compile 'com.android.support:support-v4:18.0.0'
compile 'com.android.support:appcompat-v7:+'
}
}
build.gradle file outside my "app" folder: PATH: /home/work/ProjectName/build.gradle
我的“app”文件夹外的 build.gradle 文件:路径:/home/work/ProjectName/build.gradle
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.11.+'
}
}
allprojects {
repositories {
mavenCentral()
}
}
Note after all these update synchronise your project with gradle file
注意所有这些更新后将您的项目与 gradle 文件同步
回答by Bao Le
Put below code in build.gradle file of main Application and sync it.
将以下代码放在主应用程序的 build.gradle 文件中并同步它。
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.0'
}
}
allprojects {
repositories {
mavenCentral()
}
}
Credit to Ganesh Katikar