Public static final int main = 0x7f030004;
However, as of ADT 14, they will announce the following:
Public static int main = 0x7f030004;
Missing final in the r File
In other words, the constant not final is in the library project. The reason is simple: when multiple database projects are combined, fields with actual values (which must be unique) may collide. Before ADT 14, all fields were finals, so
All libraries must have all their resources and related Java code for re-compilation and use of the main project. This is poor performance because it makes building very slow. This also prevents database project allocation, excluding the source
Code that limits the scope of use of library projects.
The reason for the field is no longer the last one. It means that the library jar can be compiled once and reused directly in other projects. And library projects that allow distribution of binary versions (in R15), which allows faster building.
However, it has an impact on the library's source code. The following code form will not be compiled:
Int id = view. GETID (); Switch (ID ){
Case R. Id. button1: action1();
break;
case R.id.button2:
action2();
break;
case R.id.button3:
action3();
break;
}
This is because the switch statement requires all the case labels, such as R. Id. button1, which remains constant during compilation (so that the values can be directly copied to the. Class file ).
The solution to this problem is very simple: Convert the switch statement into an IF-else statement. Fortunately, this is very easy in eclipse. Just insert the keyword into the switch and press Ctrl-1 (or cmd 1 on Mac ):
In the preceding scenario, the switch statement is:
Int id = view. GETID (); If (ID = R. id. button1) {Action1 ();} else if (ID = R. id. button2) {Action2 ();} else if (ID = R. id. button3) {action3 ();}
This is usually negligible in terms of UI code and performance impact.
We have a detector that discovers these errors (an R field is referenced by an inconsistent case tag) and provides a brief description of the problem (and points to this page for more information .)
More information about the automatic detection.