开发者

problem with resources and android library project

I'm having a problem adding resources to my Android project when i have a Library project referenced. This is what I'm seeing:

Both Projects compile and run fine. When i have the li开发者_C百科brary project linked and I want to add a string resource to the main project, the line is there in the XML file, everything compiles but the resources is not added to the R class. I've tried cleaning the project, removing the R class etc. But all the resources that were already there before i linked the Library are all present in R. Also the resources that were present in both projects are correctly merged.

To work around this I need to unlink the library project, comment all the references to it in the main project and then all the resources i add are added to the R class. (then I need to re-link the library).

I'm using Eclipse and ADT.

What could cause this?

Thanks!


It seems like Eclipse sometimes doesn't realize that it needs to regenerate the R.java file even with a clean + rebuild. it's the compile pass that fixes this but the resource references in code keep it from compiling. I've sometimes had to temporally comment out the lines that reference the resources just to get a clean compile. Then I uncomment those lines and suddenly everything is fine again.

Mixed with with linked libraries, Eclipse can get very flaky. Your solution of temporally turning library projects into non-library projects was the key for me today. Non-library + commented resource references + recompile + uncomment + re-library + recompile seems to be the magic formula.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜