android - 将带有版本控制系统的eclipse android项目导入Android Studio

标签 android git gradle android-studio

我正在尝试将带有版本控制系统的 Eclipse 项目导入 Android Studio。

在 Android-Studio 版本“0.5.5”中添加了对直接 eclipse 项目导入的支持,我们无需先从 eclipse 导出项目即可将其导入 Android-Studio。

我有一个 Eclipse Android 项目,我正在尝试将其导入 Android Studio。 导入成功,但导入的项目不再有版本控制。

编辑:- 更多细节

假设我有以下目录结构

Project ----
           |---------- .git/
           |----------- MyApp 
           |------------MyApp_imported

在项目导入期间,我将 Android Studio 指向项目目录“MyApp”,它将我项目“MyApp”中的所有文件复制到新目录“MyApp_Imported”。但是导入的项目没有启用版本控制。 现在我不确定如何进一步进行。 我应该如何告诉 Android Studio 将旧存储库用于导入的项目。 一步一步的指导将非常有帮助。

这是来自 Android 工具项目网站的文本

Project - Importing modules should now work properly. You can import existing Eclipse ADT projects as well as Gradle modules into an existing Gradle project; it will copy in the sources as is done for full project import, as well as handle dependencies transitively. Import modules either from the project structure dialog or the File | Import Module action. - New project structure dialog implementation: Should be faster, includes Gradle sync notification, should only perform a Gradle sync at the end when necessary, and won't list invalid IntelliJ module warnings as before.
This is actively being worked on and the individual editors (for flavors, build types, signing configurations etc) will be improved in upcoming builds.

最佳答案

这里是一步一步的解决方案。

  1. 打开 Android Studio -> 导入项目-> 选择你的项目目录。 (在上述情况下为“MyApp”) 记住选择包含 list 文件的目录,否则新的“直接导入向导”不会 被触发并且 android studio 使用旧的导入向导。
  2. Android Studio 将使用新的目录结构创建您的项目“MyApp_imported”的副本。
  3. 在“MyApp_imported”中复制现有的“.git”目录
  4. Android Studio -> VCS -> 启用版本控制 这将使 Android Studio 使用您现有的存储库来导入项目。虽然导入的项目有 不同的目录结构,但 git 可以很好地处理它们。 您可能还想在导入项目的根文件夹中调用 git add .git add -u 以确保添加了所有新文件并检测到现有文件移动通过 git。
  5. Android Studio -> 变化 查看所有文件并提交。 Git 会自动处理新的目录结构,文件历史等不会丢失。
  6. 现在您可以通过以下方式在 github/Bitbucket 上分享它 VCS-> 在 GitHub 上分享 注意:- 对于 bitbucket,您必须为 Android Studio 安装“Bitbucket plugin”。

关于android - 将带有版本控制系统的eclipse android项目导入Android Studio,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24726041/

相关文章:

android - 很难为 Android 4 中的 AppCompat 正确设置工具栏操作模式的样式

java - GSON 没有正确解析嵌套的 JSON 对象

android - 使用相机捕捉文本。安卓?

windows - 在 TortoiseGit 中添加命令

Git - 在单个命令中提交和标记

spring-boot - Spring Boot 1和Gradle:ClassNotFoundException SpringApplicationBuilder

android - 服务停止时 Widget 的 PendingIntent 丢失

git - 如何在github上上传本地子模块的文件?

java - gradle.properies 中的 Gradle 系统属性没有被使用吗? (javacpp、intellij)

android - Mapbox 4 到 Mapbox 5 错误