从eclipse迁移到Android工作室“错误:(1,0)没有找到id'com.android.application'的插件”

时间:2015-07-24 09:16:40

标签: android eclipse

我尝试将我的eclipse项目导入Android studio。但我坚持这个错误。

“错误:(1,0)没有找到id'android'的插件”

以下是我的gradle构建。

apply plugin:'com.android.application'

依赖{     编译fileTree(dir:'libs',包括:'* .jar')     编译项目(':下载:PdfLib') }

android {     compileSdkVersion 16     buildToolsVersion“22.0.1”

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')
}

}

1 个答案:

答案 0 :(得分:1)

在您的应用程序gradle上尝试此操作。您收到此错误,因为您从未定义过您的应用程序ID ..

android {
    compileSdkVersion 22
    buildToolsVersion "22.0.1"

    defaultConfig {
        applicationId "your application id or package name"
        minSdkVersion 16
        targetSdkVersion 22
    }
}

然后是依赖