将一个带有版本控制系统的eclipse android项目导入Android Studio [英] Import an eclipse android project with version control system into Android Studio

查看:21
本文介绍了将一个带有版本控制系统的eclipse android项目导入Android Studio的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I am trying to import an eclipse project with version control system into Android Studio.

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

Support for direct eclipse project import was added in Android-Studio version "0.5.5" where we don't need to export project first from eclipse to import it into Android-Studio.

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

I have an eclipse Android Project which I am trying to import into Android Studio. Import is successful but imported project no more has version control.

- 更多细节

假设我有以下目录结构

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

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

During project import, I point Android Studio to Project Directory "MyApp", It copies all files in my project "MyApp" to new directory "MyApp_Imported". But imported project doesn't have version control enabled. Now I am not sure how to proceed further. How should I tell Android Studio to use old repository for imported project. A step by step guide to do this will be very helpful .

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

Here is text from Android Tools Project Site

项目- 导入模块现在应该可以正常工作了.您可以导入现有的 EclipseADT 项目以及 Gradle 模块到现有的 Gradle 项目中;它将像完整项目导入一样复制源代码,以及传递性地处理依赖关系.从项目结构对话框或文件 | 导入模块导入模块操作.- 新的项目结构对话框实现:应该更快,包括Gradle 同步通知,应该只在最后执行 Gradle 同步必要时,不会像以前一样列出无效的 IntelliJ 模块警告.
正在积极开展这项工作,个人编辑(对于口味、构建类型、签名配置等)将得到改进在即将发布的版本中.

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.

推荐答案

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

Here is the step by step solution to do it.

  1. 打开Android Studio -> 导入项目-> 选择你的项目目录.(在上述情况下MyApp")记住选择包含清单文件的目录,否则新的直接导入向导"不会被触发并且 android studio 使用旧的导入向导.
  2. Android Studio 将使用新的目录结构创建项目MyApp_imported"的副本.
  3. 将现有的.git"目录复制到MyApp_imported"中
  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".
  1. Open Android Studio -> Import Project-> Select your project directory. (In above case "MyApp") Remember Select the directory which contains Manifest file otherwise new "direct import wizard" doesn't get triggered and android studio uses old import wizard.
  2. Android Studio will create a copy of your project "MyApp_imported" with new directory structure.
  3. Copy your existing ".git" directory inside "MyApp_imported"
  4. Android Studio -> VCS -> Enable version control This will make Android Studio use your existing repository for imported project. Though imported project has different directory structure but git handles them pretty well. You might want to also call git add . and git add -u in the root folder of the imported project to make sure all new files are added and existing file moves are detected by git.
  5. Android Studio -> Changes Review all files and commit. Git will automatically handle new directory structure and file history etc will not be lost.
  6. Now you can share it on github/Bitbucket by VCS-> Share it on GitHUb Note:- For bitbucket you will have to install "Bitbucket plugin" for Android Studio.

这篇关于将一个带有版本控制系统的eclipse android项目导入Android Studio的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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