请阅读 1 和 2。如果您不是 Android 开发人员,您仍然可以提供帮助,因为这也是一个版本控制问题。
情况如下:
我继承了一个在 IntelliJ 中创建的 Android 项目,目前正在将其导入 Eclipse 中。但路上有许多障碍......
- 在 IntelliJ 中,Android 库可以是项目的子目录(子级),但是,在 Eclipse 中,您只能选择当前工作区中的 Android 库(兄弟级)。是否可以选择子目录?
- 如果 #1 无法修复,那么我该如何处理以下问题:我有一个 Android 库项目,其中包含许多可重用组件(静态实用程序)。假设 Android Library 是该项目的同级目录。我有一个使用 Android 库的版本 1 应用程序。我现在创建一个使用 Android 库的版本 2,但我也更新了库 API(更改了一些方法)。版本 2 正在开发中,版本 1 正在维护中。当 Eclipse 清理项目时,Android 库不再与版本 1 兼容,因为 API 已更改。
继承的项目是在 IntelliJ 中构建的,Android 库是 git 存储库和 git 子模块。因此,引用是 git 提交,并且可以从外部更新存储库。我本质上需要使用 Android 库进行版本控制(我不关心使用或不使用 git 子模块)。有人有解决办法吗?
最佳答案
答案
在 IntelliJ Android 库中,Android 库可以是项目的子目录(子级),但是,在 Eclipse 中,您只能选择当前工作区中的 Android 库(兄弟级)。是否可以选择子目录?
Yes it is possible to reference a child directory(Android Library Project) in your Application project.
第 1 步:将库项目的目录添加到应用程序项目的根目录中。
Step2:将此子目录导入为eclipse中的项目。
File
->Import
, UnderAndroid
selectExisting Android Code Into Workspace
, ForRoot Directory
browse to the root directory of your app project directory. In the list of Projects you get your own project plus the library project i.e. the sub directory. Make sure that only the library project is selected and not your App. HitFinish
.
第 3 步:引用此库项目。
Go to your Application project's
Android properties
and add this library project in thelibrary section
.
你就完成了。
关于android - Git 版本控制和库项目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10746704/