Importing an eclipse project in Android studio. Er

2019-08-23 09:13发布

问题:

What I have:

  1. Eclipse Juno Service Release 2 working on windows 7 x64.
  2. Android Studio updated to 0.2.8
  3. ADT updated

What I have done

I have been developing with Eclipse for a long time and now I wanted to give a chance to Android Studio so I checked on google developers webpage and I downloaded and updated Android Studio to 0.2.8. As google says, I do need to export from eclipse creating the gradle file so I did it. After that, I opened Android studio and check what it says on google page: "Use gradle wrapper". Every time I try to import my project I get an error saying:

Could not execute build using Gradle distribution 'http://services.gradle.org/distributions-snapshots/gradle-1.8-20130830160653+0000-bin.zip'. Build file 'C:\Users\me\Eclipse\proyectos\myProject\build.gradle' line: 9 A problem occurred evaluating root project 'myProject'. A problem occurred evaluating root project 'myProject'. Gradle version 1.6 is required. Current version is 1.8-20130830160653+0000

What should I do? Everything I have looked on the net is for an update of the ide to 0.2.7 with a project that is imported and not to being imported.

EDIT

gradle file: (my project has a deppendency for which also I made a gradle file from Eclipse. "library" is actionbarSherlock library

buildscript {
repositories {
    mavenCentral()
}
dependencies {
    classpath 'com.android.tools.build:gradle:0.4'
} } apply plugin: 'android'

dependencies { compile fileTree(dir: 'libs', include: '*.jar') compile project(':C::Users:me:Eclipse:proyectos:library') }

android { compileSdkVersion 16 buildToolsVersion "18.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']
    }

    instrumentTest.setRoot('tests')
} }

回答1:

SOLVED

Finally, after the new upgrades the error has been solved. If you have this error try to update ADT to r22.2.1 and Android Studio to 0.2.9. Then, export again gradle from eclipse and try it to import it from AS.

Maybe you will have now an error with sdk dir importing the file. If so, add the variable ANDROID_HOME to windows variables with the route of your android sdk and after rebotting the computer try it again. Remember that with AS there's a new installation of ADT so you have to update also that one or change the path as shown here https://stackoverflow.com/a/18409923/1200914



回答2:

You have used Gradle 1.8, as your error mentions, you should use Gradle 1.6. Download it from here http://services.gradle.org/distributions-snapshots