Using Android library projects in custom builds

Android Library Projects are quite useful when you want to use your assets/resources in multiple projects.(about library projects)

Projects work nicely on Eclipse. But if you work on a custom build you will be faced with some problems.(thread1, thread2)You will see that resources not accessible on custom builds so you have to copy your files into your app project. If I have to copy, why I’m using library project?

Our team applied a method in make file and I liked to share it with you. We copy files programmatically and do not override the existing files.

In Android.mk :


include $(CLEAR_VARS)
$(shell cp -nr path_of_your_library path_of_your_project)
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_PACKAGE_NAME := YourPackageName
include $(BUILD_PACKAGE)

Hope this also helps to you!

Leave a Reply

*

This blog is kept spam free by WP-SpamFree.