Android Studio 导入 Eclipse 项目
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/20904002/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Android Studio import Eclipse project
提问by Robertas Setkus
Android Studio 0.4.0
安卓工作室 0.4.0
I tried to import eclipse project directly (not exported eclipse project as "generate gradle build files") and tried this migrating soliution. The result of both ways is like this:
我尝试直接导入 eclipse 项目(不是将 eclipse 项目导出为“生成 gradle 构建文件”)并尝试了这种迁移解决方案。两种方式的结果都是这样的:
Is this good project structure? And if it is not how to migrate Eclipse project to Android Studio?
这是好的项目结构吗?如果不是如何将Eclipse项目迁移到Android Studio?
Andriod Studio import log
Andriod Studio 导入日志
Google repository is installed
已安装 Google 存储库
P.S. Some Android associated buttons in toolbar are inactive after project import.
PS 项目导入后,工具栏中的一些 Android 关联按钮处于非活动状态。
回答by Scott Barta
Looking at your log file, I see this:
查看您的日志文件,我看到了:
com.intellij.openapi.externalSystem.model.ExternalSystemException: Could not find any version that matches com.google.android.gms:play-services:+.
Required by:
kmvts-rb-1.1.0:app:unspecified
which means that it can't find the Play Services repository. In your SDK Manager(click on the button in the Android Studio toolbar; that will ensure you open the SDK Manager for the copy it's using to build your project), install the Google Repository. Now you should be able to import your project.
这意味着它找不到 Play Services 存储库。在您的SDK 管理器中(单击 Android Studio 工具栏中的按钮;这将确保您打开用于构建项目的副本的 SDK 管理器),安装Google Repository。现在您应该可以导入您的项目了。
We're working on having much better handling of this situation in the future, but for now you have to know to install it yourself.
我们正在努力在未来更好地处理这种情况,但现在您必须知道自己安装它。
回答by Binoy Babu
No, that is not a good project structure. After you have generated gradle build files, make sure the project can built properly from command line using gradle. To build a project run gradlew.bat
or gradlew
from project root. You may encounter one or more errors, I've posted fixes for some commonly encountered errors here. After fixing all errors try importing to Android Studioagain.
不,这不是一个好的项目结构。你之后产生gradle这个构建文件,确保项目可以使用gradle这个命令行妥善建造。构建项目运行gradlew.bat
或gradlew
从项目根。您可能会遇到一个或多个错误,我已在此处发布了一些常见错误的修复程序。修复所有错误后,再次尝试导入到Android Studio。
回答by Fred
This link maybe helpful :
此链接可能有帮助:
How do you import an Eclipse project into Android Studio
如何将 Eclipse 项目导入 Android Studio
- The root directory of the project you import must have an AndroidManifest.xml file.
- Either: The root directory must contain the .project and .classpath files from Eclipse or The root directoy must contain res and src directories.
- 您导入的项目的根目录必须有一个 AndroidManifest.xml 文件。
- 或者:根目录必须包含来自 Eclipse 的 .project 和 .classpath 文件,或者根目录必须包含 res 和 src 目录。
回答by JamoBox
I found that the easiest way to import from Eclipse to Android Studio, is to use File -> Import project
, select the project to import from your file structure then use create project from existing sources
and select Eclipse.
我发现从 Eclipse 导入到 Android Studio 的最简单方法是使用File -> Import project
,从文件结构中选择要导入的项目,然后使用create project from existing sources
并选择 Eclipse。
If you are used to the Eclipse key bindings, Android Studio/Intellij IDEA will also let you change your keyboard binding configurations to the default eclipse ones. To do this, use Settings -> IDE Settings -> keymap
and select Eclipse from the drop down menu at the top.
如果您习惯了 Eclipse 键绑定,Android Studio/Intellij IDEA 还可以让您将键盘绑定配置更改为默认的 Eclipse 配置。为此,请使用Settings -> IDE Settings -> keymap
并从顶部的下拉菜单中选择 Eclipse。