第一步、 源码环境下重新编译jar包,参考mk:
include $(CLEAR_VARS)
LOCAL_MODULE := test
LOCAL_MODULE_TAGS := optional
LOCAL_SRC_FILES := test.jar
LOCAL_MODULE_SUFFIX := $(COMMON_JAVA_PACKAGE_SUFFIX) LOCAL_MODULE_CLASS := JAVA_LIBRARIES
include $(BUILD_PREBUILT)
通过mmm进行编译。
第二步、 拷贝编译后的文件(.jar, .vdex, .art, .rel, .oat)
cp out/target/product/generic_x86/system/framework/test.jar .
cp out/target/product/generic_x86/system/framework/boot-test.vdex .
mkdir arm
cp out/target/product/generic_x86/system/framework/arm/boot-test.art arm/
cp out/target/product/generic_x86/system/framework/arm/boot-test.art.rel arm/
cp out/target/product/generic_x86/system/framework/arm/boot-test.oat arm/
mkdir arm64
cp out/target/product/generic_x86/system/framework/arm64/boot-test.art arm64/
cp out/target/product/generic_x86/system/framework/arm64/boot-test.art.rel arm64/
cp out/target/product/generic_x86/system/framework/arm64/boot-test.oat arm64/
第三步、拷贝到设备的对应目录(需要remount)
adb push test.jar /system/framework/
adb push boot-test.vdex /system/framework/
adb push arm/boot-test.art /system/framework/arm/
adb push arm/boot-test.art.rel /system/framework/arm/
adb push arm/boot-test.oat /system/framework/arm/
adb push arm64/boot-test.art /system/framework/arm64/
adb push arm64/boot-test.art.rel /system/framework/arm64/
adb push arm64/boot-test.oat /system/framework/arm64/
第四步、 重启
adb reboot