containing both DEX and Java-bytecode content 错误
程序员文章站
2022-04-12 22:30:37
场景:1、在framework中添加自定义的jar2、需要在源码环境下生成jar包,但是不能暴露源代码。生成jar包的android.mk:LOCAL_PATH := $(call my-dir)include $(CLEAR_VARS)LOCAL_SRC_FILES := $(call all-java-files-under, core/java)#LOCAL_MODULE_TAGS := optinalLOCAL_MODULE := xxframeworkinc...
场景:
1、在framework中添加自定义的jar
2、需要在源码环境下生成jar包,但是不能暴露源代码。
生成jar包的android.mk:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_SRC_FILES := $(call all-java-files-under, core/java)
#LOCAL_MODULE_TAGS := optinal
LOCAL_MODULE := xxframework
include $(BUILD_JAVA_LIBRARY)
结果报错: containing both DEX and Java-bytecode content
原因:
BUILD_JAVA_LIBRARY编译出来的jar包,里面是DEX格式的文件
解决:使用BUILD_STATIC_JAVA_LIBRARY , BUILD_STATIC_JAVA_LIBRARY编译出来的jar包,里面每个java文件对应的class文件都单独存在
最终修改如下:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_SRC_FILES := $(call all-java-files-under, core/java)
#LOCAL_MODULE_TAGS := optinal
LOCAL_MODULE := xxframework
#include $(BUILD_JAVA_LIBRARY)
include $(BUILD_STATIC_JAVA_LIBRARY)
本文地址:https://blog.csdn.net/zyfzhangyafei/article/details/108127832
下一篇: double类型数据转换为String