Recently, I had to face few strange problems in regenerating R.java file after clean building an Eclipse based Android project. Some of the errors shown in “Error Log” view and “Problems” sections of Eclipse were :
- Error executing aapt: Return code -1073741819
- bin\resources.ap_ does not exist
- R cannot be resolved to a variable
There were no errors in XMLs or resource files as it should be, when there is a problem with R.java.
Final solution I could come up with was rechecking XML files manually and I noticed below error in main.xml menu file.
As you see above android:icon tag is having empty value which was the reason for all above problems.
Once relevant unwanted parameter was removed everything worked smoothly. Hence, if Eclipse fails to generate R.java with no marked errors in XMLs or other resource, it is better to check change history and look for any problematic values in XMLs as well.