Thursday, May 23, 2013

Convert An Android application to Library

When I deveoped an Android applicaton, I want to convert it to a libray to be shared by my other applications. This is easy to do in Eclipse. Go to Properties->Android and check "IsLibrary".
The following line will be added to project.properties


android.library=true

However you will get some errors related to R.*. You have to convert all switch-statements to
if-statements to make it a library. The reason is thoroughly explained by the following links:
http://tools.android.com/tips/non-constant-fields