The android compilation cannot find the resource ID.
Generally, the ID cannot be found for the following reasons:
1. ID Mismatch
2. xml not compiled
3. The compilation sequence is incorrect.
4. The correct resource package is not imported.
The resource files compiled under frameworks/base/CORE/RES are stored in out/target/common/R/COM/Android/Internal/R. java.
So check whether your ID is in R. Java first,
Then checkSource codeAre there:
Import com. Android. Internal. R;
Below is an extended reading
Compare android4.1 with previous versions.
In versions earlier than 4.1, add a resource (image or XML file). During compilation, the generated ID is automatically added to the public. xml file.
However, in versions 4.1 and later, the ID is not automatically generated during compilation.ProgramAdd the ID to the public. xml file.
For example
Add an image
<Java-symbol type = "drawable" name = "play_indicator_stop"/>
Layout)
<Java-symbol type = "layout" name = "select_dialog"/>
I thought that if a layout file is added, the layout file is similar
<Imageview Android: Id = "@ + ID/play_indicator"
The added ID does not need to be added to public. xml. It turns out that you still need to add the following:
<Java-symbol type = "ID" name = "play_indicator "/
This is a problem I encountered today. Later I studied the source code. Find this difference. I hope this error will stop!
-- Open source! Knowledge belongs to everyone!