现在如何将Eclipse项目导入到Android Studio? [英] How do you import an Eclipse project into Android Studio now?

查看:153
本文介绍了现在如何将Eclipse项目导入到Android Studio?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Android Studio中使用导入项目,用于更改项目结构并生成Gradle文件的Eclipse项目,但现在(我使用的是AS 0.5.3),它只生成IDEA文件(.iml,.idea )但不是Gradle,它也不会触及文件结构。

Using "Import Project" in Android Studio for an Eclipse project used to change the project structure and generate Gradle files, but right now (I'm using AS 0.5.3) it's only generating IDEA files (.iml, .idea) but not Gradle and it's not touching the file structure either.

如何将Eclipse项目导入Android Studio?

How do you import an Eclipse project into Android Studio now?

更新:尝试在Eclipse中导出gradle文件不会将其导出为应用程序,它不会在Android Studio中显示为模块。

Update: Trying to export gradle files in Eclipse won't export them for the app, it doesn't show up as a module in Android Studio either.

推荐答案

在较新版本的Android Studio中,引入Eclipse / ADT项目的最佳方式是将其直接导入到Android Studio中;我们曾经建议您将它从Eclipse导出到Gradle,但是我们还没有经常更新ADT,足以跟上Android Studio的步伐。

In newer versions of Android Studio, the best way to bring in an Eclipse/ADT project is to import it directly into Android Studio; we used to recommend you export it from Eclipse to Gradle first, but we haven't been updating ADT often enough to keep pace with Android Studio.

无论如何您从文件菜单中选择导入项目,或者在启动Android Studio时从欢迎屏幕中选择导入项目,它将引导您完成一个专门向导,提示您打算将文件复制到新的目录结构中,而不是将其导入 - 它将提供一些常见的东西,例如将依赖关系转换为Maven风格的包括等。

In any event, if you choose "Import Project" from the File menu or from the Welcome screen when you launch Android Studio, it should take you through a specialized wizard that will prompt you that it intends to copy the files into a new directory structure instead of importing them in-place, and it will offer to fix up some common things like converting dependencies into Maven-style includes and such.

看起来不像你这样专业流程。我认为可能没有将您的导入项目识别为ADT项目,并且它默认为不熟悉Gradle的旧内置IntelliJ行为。要获得专门的导入工作,请执行以下操作:

It doesn't seem like you're getting this specialized flow. I think it may not be recognizing your imported project as an ADT project, and it's defaulting to the old built-into-IntelliJ behavior which doesn't know about Gradle. To get the specialized import working, the following must be true:


  • 您导入的项目的根目录必须有一个 AndroidManifest




    • 根目录必须包含 .project来自Eclipse的 .classpath 文件

    • 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

      • 根目录必须包含 res src 目录。

      • The root directory must contain res and src directories.

      如果您的项目很复杂,也许您没有将其指向要导入成功的根目录。

      If your project is complex, perhaps you're not pointing it as the root directory it wants to see for the import to succeed.

      这篇关于现在如何将Eclipse项目导入到Android Studio?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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