Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the easiest way to force Idea to generate the R.Java file?

I am trying to run Android sample applications using intellij idea and R.Java file is missing form notepad samples source directory.

like image 665
Jigar Avatar asked Apr 12 '10 08:04

Jigar


3 Answers

Make sure you have the right settings: project structure -> Facets -> Android -> yourproject -> compiler

Check compile resources by IDE and Regenerate R.java when resources are changed.

This stole most of my morning, hopefully I'll save someone else some time:)

like image 143
Karl Avatar answered Sep 28 '22 02:09

Karl


Make sure you have a gen folder in your project root. If you don't, make one yourself.

like image 29
Jim Blackler Avatar answered Sep 28 '22 01:09

Jim Blackler


Use Build | Make. Actually, IDEA generates R.java file automatically every time you make a change in any XML file under the /res directory.

UPDATE: /gen directory must be present in the project and also configured as a Source root in IDEA module so that it can resolve the IDs in your source code.

like image 32
CrazyCoder Avatar answered Sep 28 '22 01:09

CrazyCoder