In my android application I have created 2 projects. The main project and a library one since it will be used in future projects as well. Since I would like to reference some views in code I tried to create a resource type file to declare some unique ids as stated here http://developer.android.com/guide/topics/resources/more-resources.html#Id.
The problem is that when I add this file to res/values (called ids.xml) the R file is not generated anymore. When I delete it everything works fine.
I know that I can add an id resource type file in an android project. Is there a limitation to do the same in a library project?
Thank you,
Bill
After 2 days of research I finally found the solution.
The post [here][1]
[1]: Android style Resources compile (aapt) failing : Bad resource table: header size 0xc helped me.
It doesn’t matter if it’s an Android project or a library one, but when you have declared a new id in one of your styles then you cannot add an ids.xml file to declare unique ids.
In my case, I had declared a style in my res/values/styles.xml
and then added a res/values/ids.xml where I declared some unique ids. For example,
After adding this file, R stopped generating. Project Clean didn’t do the work.
When I changed the declaration in styles.xml to @id/actionbar_container, R started generating again. The difference is that I have declared the id in my ids.xml file while I reference in the style above using @id and not @+id.
Conclusion: If you want to declare unique ids in a resource file (i.e. ids.xml) double-check that you have not declared any new ids (using the @+id syntax) in your styles first.
Hope that helps anyone with the same problem.
Happy coding!!!