Search code examples
androidprojectmanifestandroid-resourcesr.java-file

Linking two projects, other R.java not generated


I have been writting an app that is bulid of two projects. They were working fine, but lately I moved my project to new computer and problems with linking these two occured. I moved them manualy, on pendrive, so I had to add all project imports again.

First there were problems with importing specyfic classes, but I have solved that by right-clicking on project -> Build path -> configure build path -> projects -> add and adding second project. Great, that worked. But that's not all.

Every time I try to get some resources from other project (for example using setTheme(R.style.someStyle) I receive error "someStyle cannot be resolvet or is not a field". I found out that is becouse Eclipse didn't generated second R.java in gen directory. I had that on my previous computer. After oppening gen there were two "packages", each containing R.java from other project. Now I have just one.

Do you know how to fix it?


Solution

  • You can make a new project and then copy all classes and resources from "src" and "res" folder to new project, then you can build your new project.