Unable to import Eclipse project to Android Studio

前端 未结 3 818
梦谈多话
梦谈多话 2020-11-28 03:30

Whenever I try to import my Eclipse project to Android Studio I get the following error :

You are using an old, unsupported version of Gradle. Please

相关标签:
3条回答
  • 2020-11-28 04:20

    I had exactly the same problem. I solved this issue. Download latest Gradle manually and unpack it, then when you import gradle file in Android studio choose "Use local gradle distribution" and select the folder where you unpacked gradle. By doing this you will be able to import project to Android studio.

    0 讨论(0)
  • 2020-11-28 04:29

    For me line in build.gradle file

    dependencies {
        classpath 'com.android.tools.build:gradle:0.5.+'
    }
    

    to

    dependencies {
        classpath 'com.android.tools.build:gradle:0.6.+'
    }
    

    Also needed to be updated to import correctly in Android Studio.

    0 讨论(0)
  • 2020-11-28 04:35

    I had to edit the gradle wrapper settings in gradle/wrapper/gradle-wrapper.properties and change gradle version to 1.9.

    ./gradle/wrapper/gradle-wrapper.properties :

    #Wed Apr 10 15:27:10 PDT 2013
    distributionBase=GRADLE_USER_HOME
    distributionPath=wrapper/dists
    zipStoreBase=GRADLE_USER_HOME
    zipStorePath=wrapper/dists
    distributionUrl=http\://services.gradle.org/distributions/gradle-1.9-all.zip
    

    I had to change gradle-1.6-bin.zip to gradle-1.9-all.zip. I guess the old ADT plugin from eclipse which generates this file still uses the old URL.

    Then I had to create a local.properties in project root and set correct SDK dir in it.

    ./local.properties

    sdk.dir=/home/user/pathtosdk
    

    Did that and imported using default gradle wrapper and voila! The project imported without any problem.

    Notes: This also fixes the issue with org.gradle.tooling.GradleConnectionException: Could not execute build using Gradle distribution 'services.gradle.org/distributions/gradle-1.6-bin.zip';.: Could not execute build using Gradle distribution 'services.gradle.org/distributions/gradle-1.6-bin.zip'; You must also make sure that in the file ./build.gradle, com.android.tools.build:gradle:0.5.+ should be changed to com.android.tools.build:gradle:0.7.+.

    If you are still experiencing problems with import, open up the project root in command line and run ./gradlew or gradlew.bat according to your os. You'll be getting errors with more debug info and maybe tips on how to solve them.

    0 讨论(0)
提交回复
热议问题