Android: targeted res folders for debugging in eclipse

左心房为你撑大大i 提交于 2019-12-18 08:00:07

问题


I have a project which I have a number of different branded versions, with two different res folders. ie. res-customer1, res-customer2 Using Maven build profiles I can easily build the project using the specified res folder.

However when it comes to eclipse its another story. What I want to do is to have a setting so that I can specify the res folder that I want, whilst debugging in eclipse.

Anyone know how I can do this?

My current work around is to copy the res-customer1 folder into the res folder work on it and debug in eclipse then move it back to res-customer1 before I can build it using Maven. I don't really want to be doing this as it will be easy to make a mistake and cause myself loads of problems, if I could just direct eclipse to the folder, rather than moving the folder for eclipse would be much less hassle.

Any ideas? Thanks in Advance


回答1:


You can use Link Source in Eclipse, right-click your project, choose Build Path -> Link Source...:

UPDATE: For some Eclipse versions use this link

Final look in Project Explorer:

Note that the little sign in the res folder icon

, it is just a symbolic link poing to the res-customer1 folder. The beautiful point in this approach is the existing project folder in file system remain the same, you don't need a solid res folder from the beginning.


回答2:


Just a though, and not tested, but I wonder if you could make the res folder a symbolic link to one or the other of your res-custmer#folder, then have a shell script that will change the symbolic link. I know that you can drag and drop a folder/file in a project and make it link to it instead of copying the data in the project folder.

Another Idea could be to have your res-customer# embedded in a library project, and include one or the other project (this can be donne quite easily by commenting lines in the project.properties file)



来源:https://stackoverflow.com/questions/11340837/android-targeted-res-folders-for-debugging-in-eclipse

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!