Should R.java be placed under version control
Is R.java file generated by Andr开发者_JAVA百科oid SDK on each compile or only when new resources are added using Eclipse? Do I need to put it under version control or not?
The R.java
file is generated during resource compilation by aapt
tool. You shouldn't add it to source control system.
Also, you should have noted the gen
folder where R.java
is placed. Your version control system should ignore this folder altogether, not only R.java
file inside it. Because this folder is deleted on clean build (not sure about eclipse, but ant
script definitely deletes it).
When using Git to control Android projects I add
bin/*
gen/
to .gitignore
You don't need to put it under version control. I think it's on each compile, one every new resource or clean up project.. but need to test to be sure.
I have had projects with R in and out of source control. Both worked.
When the android SDK is loaded into eclipse, it will automatically generate the R.java file. In older versions of the adt, having an incorrect R.java file would give an error, but I believe this is fixed now, and it shouldn't matter either way. If you have the choice though, avoid checking it in.
I would add it to svn:ignore
.
精彩评论