标签:
1.首先 android.mk
LOCAL_PATH := $(call my-dir)
# ============================================================
include $(CLEAR_VARS)
LOCAL_SRC_FILES := java/com/xxx/xxx/xxx.java \
java/com/xxx/xxx/xxx2.java
LOCAL_NO_STANDARD_LIBRARIES := true
LOCAL_JAVA_LIBRARIES := core framework
LOCAL_MODULE_TAGS := eng
LOCAL_MODULE:= test
LOCAL_DX_FLAGS := --core-library
include $(BUILD_JAVA_LIBRARY)
# this is will add the test.xml
#===============================================================
include $(CLEAR_VARS)
LOCAL_MODULE := test.xml
LOCAL_MODULE_CLASS := ETC
# This will install the file in /system/etc/permissions
LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/permissions
LOCAL_SRC_FILES := $(LOCAL_MODULE)
include $(BUILD_PREBUILT)
include $(call all-makefiles-under,$(LOCAL_PATH))
2.test.xml 内容
<permissions>
<library name="yecon" file="/system/framework/yecon190.jar"/>
</permissions>
3.makesdk.sh
#!/bin/sh
if [ -d $xxx_DIR -a -d $ANDROID4 ]; then
echo "xxx_DIR is : $xxx_DIR"
MANIFEST_FILE=$xxx_DIR/frameworks/xxx/core/MANIFEST.MF
xxxx_SRC_FILE=$ANDROID4/out/target/common/obj/JAVA_LIBRARIES/xxxxx_intermediates/classes
SDK_PATH=$ANDROID4/xxx/sdk
if [ -d $ATCJAR_FILE ];then
mkdir -p $SDK_PATH
chmod a+x $SDK_PATH
jar cvfm $SDK_PATH/yxxx.jar $MANIFEST_FILE -C $xxxx_SRC_FILE
.
chmod a+x -R $SDK_PATH
else
echo "++++No such directory: $xxxx_SRC_FILE!+++++"
fi
else
echo "xxx or Android dir not set"
echo "please run command : source ./selfenv bootmedia"
echo "e.g. source ./selfenv sd2"
fi
4.MANIFEST.MF
Manifest-Version: 1.0
Created-By: yecon
Specification-Vender: yecon
Specification-Version: 1.0.0
5.然后将 xxxx 与 xxx.xml 放入系统配置中编译 PACKAGE= XXXX \
xxxx.xml
6. 在init.rc 中加入
BOOTCLASSPATH " :/system/framework/xxxx.jar "
7.应用或者其他jar中调用
LOCAL_STATIC_JAVA_LIBRARIES := xxxxx
或者
LOCAL_JAVA_LIBRARIES := xxxxx
标签:
原文地址:http://blog.csdn.net/guidian103/article/details/44489393