我尝试在aosp 5.1中制作NfcNci模块(这是com.android.nfc apk服务)
这是我的android.mk
:
LOCAL_PATH:= $(call my-dir)
########################################
# NXP Configuration
########################################
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := optional
LOCAL_SRC_FILES := \
$(call all-java-files-under, src)
LOCAL_SRC_FILES += \
$(call all-java-files-under, nxp)
LOCAL_PACKAGE_NAME := Nfc
LOCAL_CERTIFICATE := platform
LOCAL_JNI_SHARED_LIBRARIES := libnfc_jni
LOCAL_PROGUARD_ENABLED := disabled
include $(BUILD_PACKAGE)
########################################
# NCI Configuration
########################################
include $(CLEAR_VARS)
LOCAL_WITH_DEXPREOPT := true
LOCAL_DISABLE_DEXPREOPT := false
LOCAL_MODULE_TAGS := optional
LOCAL_SRC_FILES := \
$(call all-java-files-under, src)
LOCAL_SRC_FILES += \
$(call all-java-files-under, nci)
LOCAL_PACKAGE_NAME := NfcNci
LOCAL_OVERRIDES_PACKAGES := Nfc # we override here NfcNci -> so we only supposed to create the Nfc app
LOCAL_CERTIFICATE := platform
LOCAL_JNI_SHARED_LIBRARIES := libnfc_nci_jni
LOCAL_PROGUARD_ENABLED := disabled
include $(BUILD_PACKAGE)
include $(call all-makefiles-under,$(LOCAL_PATH))
当我仅使用以下命令编译该模块时:make NfcNci
我得到的.apk内部没有.dex,外部没有.odex,我的android设备无法运行它。
当我使用命令make NfcNci DISABLE_DEXPREOPT=false WITH_DEXPREOPT=true
进行编译时,它会编译.apk和.odex,但是.odex没有我的.apk jars。
(这是aosp构建系统发送的dex2oat
的命令:
target dex2oat: out/target/product/manta/dex_bootjars/system/framework/arm/boot.art (out/target/common/obj/JAVA_LIBRARIES/core-libart_intermediates/javalib.jar out/target/common/obj/JAVA_LIBRARIES/conscrypt_intermediates/javalib.jar out/target/common/obj/JAVA_LIBRARIES/okhttp_intermediates/javalib.jar out/target/common/obj/JAVA_LIBRARIES/core-junit_intermediates/javalib.jar out/target/common/obj/JAVA_LIBRARIES/bouncycastle_intermediates/javalib.jar out/target/common/obj/JAVA_LIBRARIES/ext_intermediates/javalib.jar out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/javalib.jar out/target/common/obj/JAVA_LIBRARIES/telephony-common_intermediates/javalib.jar out/target/common/obj/JAVA_LIBRARIES/voip-common_intermediates/javalib.jar out/target/common/obj/JAVA_LIBRARIES/ims-common_intermediates/javalib.jar out/target/common/obj/JAVA_LIBRARIES/mms-common_intermediates/javalib.jar out/target/common/obj/JAVA_LIBRARIES/android.policy_intermediates/javalib.jar out/target/common/obj/JAVA_LIBRARIES/apache-xml_intermediates/javalib.jar)
Install: out/target/product/manta/system/app/NfcNci/arm/NfcNci.odex
当我的班级存放在.jar中的不同位置时,以下是构建日志中的相关行:
target Java: NfcNci (out/target/common/obj/APPS/NfcNci_intermediates/classes)
Copying: out/target/common/obj/APPS/NfcNci_intermediates/classes-jarjar.jar
Copying: out/target/common/obj/APPS/NfcNci_intermediates/emma_out/lib/classes-jarjar.jar
Copying: out/target/common/obj/APPS/NfcNci_intermediates/classes.jar
Copying: out/target/common/obj/APPS/NfcNci_intermediates/noproguard.classes.jar
Copy: dx (out/host/linux-x86/obj/EXECUTABLES/dx_intermediates/dx)
Notice file: dalvik/dx/NOTICE -- out/host/linux-x86/obj/NOTICE_FILES/src//bin/dx.txt
Install: out/host/linux-x86/bin/dx
target Dex: NfcNci
Copying: out/target/common/obj/APPS/NfcNci_intermediates/classes.dex
Notice file: external/bouncycastle/NOTICE -- out/host/linux-x86/obj/NOTICE_FILES/src//framework/bouncycastle-host.jar.txt
target Package: NfcNci (out/target/product/manta/obj/APPS/NfcNci_intermediates/package.apk)
如何说服建筑系统使用适用于我的服务/ apk的正确文件来创建.ODEX文件?
谢谢。