In many cases, the following error is reported during the second development and compilation of the source code:
Packages/apps/settings/src/COM/Android/settings/powersaver/powersaverdialogactivity. Java: 50: cannot find symbol
Symbol: Variable topowersaversettings
Location: Class com. Android. settings. R. ID
Topowersaverbutton = (button) findviewbyid (R. Id. topowersaversettings );
We clearly imported the layout file and affirmed the button, but the system still reported an error during compilation.
You can solve the problem in two ways:
1. Delete Android. R from the XX. Java (powersaverdialogactivity. Java) Import file.
Delete import com. anroid. R;
2. Import the project in eclipse and solve the problem through direct operations in the project.
(1) Use new project> Android project> Settings (such as settings ).
(2) copy the file directly to the XX folder in the project. For example, copy test. XML to the layout folder. If a new file has been added, delete it before copying it.
(3) Clean Project, and then build.
The first case is that the R file is not correctly exported. Import com. Android. settings. R;
The second is that the resource file ID has not changed;