Friday, March 14, 2014

custom JAVA library JAR in Android devices

Use custom library JAR in Android devices(Kitkat)
1. Create "MySystemLib"folder under AOSP_ROOT/device/sample/frameworks/MySystemLib
2. Put JAR source code in  AOSP_ROOT/device/sample/frameworks//MySystemLib
    Should include forder "java", Android.mk, com.my.internal.lib.xml
 
    Android.mk:
ifneq ($(TARGET_BUILD_JAVA_SUPPORT_LEVEL),)
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_SRC_FILES := \
            $(call all-subdir-java-files)
LOCAL_MODULE_TAGS := optional
# This is the target being built.
LOCAL_MODULE:= com.my.internal.lib
include $(BUILD_JAVA_LIBRARY)
include $(CLEAR_VARS)
LOCAL_SRC_FILES := $(call all-subdir-java-files) $(call all-subdir-html-files)
LOCAL_MODULE:= LauncherFacadeInterface
LOCAL_DROIDDOC_OPTIONS := com.sprint.internal.idinterface
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
LOCAL_DROIDDOC_USE_STANDARD_DOCLET := true
include $(BUILD_DROIDDOC)
endif # JAVA_SUPPORT

3. "make  com.my.internal.lib" or "mm -B"
4.  com.my.internal.lib.jar is generated in 'out/target/product/generic/system/framework'
5. Put com.my.internal.lib.jar  in /system/framework in android devices
6. Put com.my.internal.lib.xml in /system/framework/etc/permission in android devices
7.  Reboot device to refresh system lib
8. Declare lib in manifest.xml
   
            android:name="com.my.internal.lib"
             />

No comments:

Post a Comment