错误:(9,0)带有id' android'的插件未找到

时间:2014-12-28 15:10:21

标签: android android-studio build.gradle

我做了一切,因为它在所有论坛上都有解释,但我仍然得到同样的错误。我按照此处所述做了所有事情http://tools.android.com/tech-docs/new-build-system/migrating-from-eclipse-projects

这是我在build.gradle中的代码

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        'com.android.tools.build:gradle:1.0.0-rc4'
    }
}
apply plugin: 'android'

android {

    compileSdkVersion 18
    buildToolsVersion "21.1.1"

    buildTypes { release {
        minifyEnabled true
        proguardFiles getDefaultProguardFile('proguard-android.txt'),
                'proguard-rules.txt' } }

    sourceSets {
        main {
            manifest.srcFile 'AndroidManifest.xml'
            java.srcDirs = ['src']
            resources.srcDirs = ['src']
            aidl.srcDirs = ['src']
            renderscript.srcDirs = ['src']
            res.srcDirs = ['res']
            assets.srcDirs = ['assets']
        }

        // Move the tests to tests/java, tests/res, etc...
        instrumentTest.setRoot('tests')

        // Move the build types to build-types/<type>
        // For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...
        // This moves them out of them default location under src/<type>/... which would
        // conflict with src/ being used by the main source set.
        // Adding new build types or product flavors should be accompanied
        // by a similar customization.
        debug.setRoot('build-types/debug')
        release.setRoot('build-types/release')
    }
}

我做错了什么?

2 个答案:

答案 0 :(得分:0)

尝试在依赖项中将'com.android.tools.build:gradle:1.0.0-rc4'更改为'com.android.tools.build:gradle:1.0.0'

答案 1 :(得分:0)

更改您当前的依赖关系,例如

buildscript {
repositories {
    mavenCentral()
}
dependencies {
    classpath 'com.android.tools.build:gradle:0.5.+'
}

}