简体   繁体   English

将android资源和活动从主项目移动到库项目

[英]Moving android resources & activities from main project to library project

I have an android project which relies on a 'common' android library project. 我有一个依赖于“通用” android库项目的android项目。

Now that I want to create a differing build of the main project, I thought I would move all activities, resources etc that would apply to both to the library project, then only keep the differences in the main projects. 现在,我想为主项目创建一个不同的版本,我想我将所有适用于图书馆项目的活动,资源等移至库项目,然后仅保留主项目中的差异。

However, when I copy resources & activities over, the library project refuses to build the R class, which causes problems. 但是,当我复制资源和活动时,图书馆项目拒绝建立R类,这会引起问题。 I know that assets require a duplicate copy, but thought res & activities would work fine. 我知道资产需要重复副本,但认为资源和活动会很好。

Is there some weird trick, to moving resources and activity code to the library project? 将资源和活动代码转移到库项目中是否有一些怪异的技巧?

I am using eclipse. 我正在使用日食。

I think you want to have the 2 same project in the workspace. 我想您想在工作区中有两个相同的项目。

If it is, you can follow this: 如果是这样,您可以按照以下步骤操作:

1) Create a zip of your current project from the workspace. 1)从工作区创建当前项目的zip。

2) Import this zip file in your current work space, where your first project is already there. 2)将该zip文件导入您当前的工作空间中,该工作空间中已存在第一个项目。

Note: If you import that zip file it give you an error project already exists in the workspace. 注意:如果导入该zip文件,它将为您提供一个错误项目,该项目已存在于工作空间中。

Now what all you have to do is just rename your first project. 现在,您要做的就是重命名第一个项目。 After that you can import that zip file -> now both projects will exist in your workspace. 之后,您可以导入该zip文件->现在, 这两个项目都将存在于您的工作空间中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM