Android R constants do not support auto-update

I searched high and low for people with the same question, but found only some options (i.e. the R file is not generated at all) that do not help. I am VERY new to Android development (first day, actually), but from some of the tutorials I read, this behavior is unexpected. Basically, let's say I create a TextView in my activity XML file and give it the corresponding android: id. I save the file (and all other files), but if I try to use findViewById in my Java file, then the name is R.id. [view name] will not be displayed (and displays an error if I manually type it). If I run the Build Project, it works, but there will be a huge load to run the Build command when creating each new component! Has anyone else experienced this or had ideas on why this is happening? Thanks in advance!

+4
source share
2 answers

If everything else that you mentioned is true, then the only way for you NOT to get the correct R variables is that you can import "android.R;" a file instead of your actual R file "your.package.R", which contains the variables you are looking for.

Hello!

0
source

You may need to tell your IDE that you need to automatically rebuild your changes. For example, in Eclipse, it will: Window > Preferences > General > Workspace. Make sure checked Build automatically.

0
source

All Articles