1. When you create a new Android library project or convert an existing project into an Android library project, if the project source code has the following statement:
int id = View.getid ();
Switch (ID) {
Case R.id.button1:
Action1 ();
Break
Case R.id.button2:
Action2 ();
Break
Case R.ID.BUTTON3:
Action3 ();
Break
}
will prompt the case expressions must to be constant expressions error because the resource constants in ADT14 after the r.class of the Android Library project are not final type, cause
See Http://tools.android.com/tips/non-constant-fields official explanation. So the example above R.id.button1 no longer ask constants, it can't be used in the switch structure, simple to solve
The method is to convert the switch into a if-else statement, which is very easy to implement in eclipse, place the cursor over the switch keyword, press ctrl+1, and then replace it with the following figure
2. If you have an activity in the Android Library project, you may not have to declare it in the Library project's manifest file, but be sure to make a declaration in the project that uses the library because the manifest configuration file is independent to the project and cannot be reused.
3. If you use a third-party jar package in your Android library project, you should also talk about importing it into the project that uses the library
4. If you find an error message that reports the following at run time:
Android library projects cannot be launched
I think this kind of problem must end up in Eclipse's properties, and finally, in the Android option, there will be a front tick in the is library, and then there won't be any errors!
Author: csdn blog hits Fung
See more highlights of this column: http://www.bianceng.cnhttp://www.bianceng.cn/OS/extra/