在Android studio中导入eclipse项目。 Gradle错误 [英] Importing an eclipse project in Android studio. Error with Gradle

查看:417
本文介绍了在Android studio中导入eclipse项目。 Gradle错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有:


  1. Eclipse Juno Service Release 2在Windows 7 x64上工作。 >
  2. Android Studio更新到0.2.8

  3. ADT更新

我做了什么

我一直在Eclipse开发很长一段时间,现在我想给Android Studio一个机会,所以我在google开发者网页上检查,我下载并更新了Android Studio到0.2.8。正如谷歌所说,我确实需要从eclipse导出创建毕业文件,所以我做到了。之后,我打开了Android工作室,并检查它在谷歌页面上说的:使用渐变包装。每次尝试导入我的项目时,我会收到一条错误:

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:


无法使用Gradle分发 http://services.gradle.org/distributions-snapshots/gradle-1.8-20130830160653 + 0000-bin.zip
构建文件'C:\Users\me\Eclipse\proyectos\myProject\build.gradle'行:9
评估根项目'myProject'时出现问题。
评估根项目'myProject'时出现问题。
需要Gradle版本1.6。当前版本是1.8-20130830160653 + 0000

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

我该怎么办?我在网上看到的一切都是将ide更新为0.2.7,导入并导入的项目。

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.

编辑

毕业文件:(我的项目有一个deppendency,我也从Eclipse做了一个毕业文件。库是actionbarSherlock库

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'

依赖关系{
编译fileTree(dir:'libs',include:'* .jar')
编译项目(':C :: Users:me:Eclipse :proyectos:library')}

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

android {
compileSdkVersion 16
buildToolsVersion18.0.1

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



推荐答案

SOLVED

最后,新的升级后,错误已经解决了。如果您有此错误,请尝试将ADT更新为r22.2.1和Android Studio至0.2.9。然后,再次从eclipse导出,然后尝试从AS导入它。

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.

也许你现在有一个错误,sdk dir导入文件。如果是这样,使用android sdk的路由将变量ANDROID_HOME添加到Windows变量中,然后重新计算机再次尝试。请记住,使用AS时,需要安装新的ADT,因此您还必须更新一个或更改路径,如下所示: https:// stackoverflow .com / a / 18409923/1200914

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

这篇关于在Android studio中导入eclipse项目。 Gradle错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆