本文介绍了无法Eclipse项目导入到Android工作室的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每当我试图导入我的Eclipse项目到Android Studio中,我得到了以下错误:

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

您使用的是摇篮的老,不支持的版本。请使用  版本1.8或更高版本。请指向一个支持的摇篮版本  该项目的摇篮设置,或在项目的摇篮包装(如  适用。)

请IDE日志的详细信息(帮助|查看日志)

Consult IDE log for more details (Help | Show Log)

即时通讯使用的是Android 0.3工作室和Ubuntu,我也试了一下在Windows 8中使用全新安装,但得到了同样的错误。我使用默认的摇篮包装,我尝试选中和取消选中自动导入选项。这是一个错误?我怎样才能解决它。如何更新摇篮到1.8或检查当前的摇篮版本?

Im using Android Studio 0.3 and Ubuntu, I also tried it on a Windows 8 box with fresh install but getting the same error. I'm using default gradle wrapper and I tried checking and unchecking auto import option. Is this a bug? How can I get around it. How do I update gradle to 1.8 or check the current gradle version?

推荐答案

我来编辑的摇篮包装器设置的在摇篮/封装/ gradle-wrapper.properties 和变化摇篮版本1.9。

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

./摇篮/包装/ 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

我不得不改变的 gradle-1.6-bin.zip 的到的 gradle-1.9-all.zip 的。我想老ADT插件从Eclipse中生成该文件仍然使用旧的URL。

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.

于是我不得不在它创建的​​ local.properties 的中的项目的根的,并设置正确的SDK目录。

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.

注:使用分配摇篮services.gradle.org/distributions/gradle-1.6-bin.zip无法执行编译:这还用的 org.gradle.tooling.GradleConnectionException修复该问题;:莫非利用分布摇篮services.gradle.org/distributions/gradle-1.6-bin.zip不执行建设; 的还必须确保该文件中的 ./ build.gradle 的, com.android.tools.build:gradle:0.5。+ 应改为 com.android.tools.build:gradle:0.7。+

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.+.

如果您仍然遇到问题导入,在命令行运行 ./ gradlew gradlew.bat 根据您的操作系统。您将如何解决这些问题得到更多的调试信息的错误,也许提示。

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.

这篇关于无法Eclipse项目导入到Android工作室的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-05 20:59