0

I have imported eclipse project in to Android Studio and I am getting error like

Error:The project is using an unsupported version of the Android Gradle plug-in (0.12.2). The recommended version is 2.1.0.

my build.gradle file is

apply plugin: 'com.android.application'
dependencies {
    compile fileTree(dir: 'libs', include: '*.jar')
    compile project(':appcompat_v7')
}
android {
    compileSdkVersion 23
    buildToolsVersion "24.0.0 rc4"

    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')
    }
}
Nongthonbam Tonthoi
  • 12,667
  • 7
  • 37
  • 64

1 Answers1

0

Your project level build.gradle file should look something like this:

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.1.0'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}
Nongthonbam Tonthoi
  • 12,667
  • 7
  • 37
  • 64
  • hi I just copied above block just and replaced below blockthe dependencies { compile fileTree(dir: 'libs', include: '*.jar') compile project(':appcompat_v7') } and getting this error Error:(15, 1) A problem occurred evaluating project ':DMH'. > Cannot add task ':DMH:clean' as a task with that name already exists. – Android Developer Jun 01 '16 at 08:38
  • This is for project level build.gradle file not for your module level build.gradle – Nongthonbam Tonthoi Jun 01 '16 at 08:43
  • Please go through http://tools.android.com/tech-docs/new-build-system/migrating-from-eclipse-projects and http://stackoverflow.com/questions/22791150/how-do-you-import-an-eclipse-project-into-android-studio-now – Nongthonbam Tonthoi Jun 01 '16 at 08:45
  • Thanks for rply I will check it out – Android Developer Jun 01 '16 at 08:49