trouble writing output: Too many methods: 65816; max is 65536. By package bug
max is 65536 ,这是一个很神奇的数字,baidu都查的到
java中规定一个包里只需容纳2^16个method,如果超出了就需要打包
如果超了会出现bug
trouble writing output: Too many methods: 65816; max is 65536. By package: 26 android 145 android.accessibilityservice 700 android.accounts 436 android.animation 8 android.annotation 3857 android.app 240 android.app.admin 308 android.app.backup 105 android.appwidget 1066 android.bluetooth 1741 android.content 956 android.content.pm 499 android.content.res 522 android.database 497 android.database.sqlite 91 android.ddm 5 android.debug 163 android.drm 51 android.drm.mobile1 30 android.emoji 23 android.filterfw 817 android.filterfw.core 26 android.filterfw.format 42 android.filterfw.geometry 46 android.filterfw.io 83 android.filterpacks.base 410 android.filterpacks.imageproc 6 android.filterpacks.numeric 17 android.filterpacks.performance 18 android.filterpacks.text 29 android.filterpacks.ui 18 android.filterpacks.videoproc 21 android.filterpacks.videosink 86 android.filterpacks.videosrc 。。。
所以需要把一部分分包,名字叫接口分离技术:
之后
需要在\build\target\product\core.mk加入PRODUCT_PACKAGES,将一些多余的接口加入到其它中
具体网站:https://github.com/CyanogenMod/android_frameworks_base/commit/854f6f736b90d33b59b5a85bcecf72a416c43b7d
./frameworks/base/Android.mk
@@ -28,10 +28,25 @@ framework_res_source_path := APPS/framework-res_intermediates/src # the library # ============================================================ +# +# These will be included in framework2 to avoid issues with the limit +# on the number of classes/dex +SECONDARY_FRAMEWORKS_SUBDIRS := \ + core/java/android/test \ + core/java/android/gesture \ + core/java/android/speech/srec \ + media/java/android/media/videoeditor \ + media/java/android/media/audiofx \ + media/mca/effect/java/android/media/effect \ + media/mca/effect/java/android/media/effect/effects + include $(CLEAR_VARS) # FRAMEWORKS_BASE_SUBDIRS comes from build/core/pathmap.mk LOCAL_SRC_FILES := $(call find-other-java-files,$(FRAMEWORKS_BASE_SUBDIRS)) +SECONDARY_SRC_FILES := $(call find-other-java-files,$(SECONDARY_FRAMEWORKS_SUBDIRS)) + +LOCAL_SRC_FILES := $(filter-out $(SECONDARY_SRC_FILES),$(LOCAL_SRC_FILES)) # EventLogTags files. LOCAL_SRC_FILES += \ @@ -252,6 +267,7 @@ $(full_classes_compiled_jar): $(framework_res_R_stamp) $(LOCAL_INSTALLED_MODULE): | $(dir $(LOCAL_INSTALLED_MODULE))framework-res.apk framework_built := $(call java-lib-deps,framework) +framework_built += $(call java-lib-deps,framework2) # AIDL files to be preprocessed and included in the SDK, # relative to the root of the build tree. @@ -390,6 +406,7 @@ framework_docs_LOCAL_JAVA_LIBRARIES := \ core \ ext \ framework \ + framework2 \ framework_docs_LOCAL_MODULE_CLASS := JAVA_LIBRARIES framework_docs_LOCAL_DROIDDOC_HTML_DIR := docs/html @@ -664,7 +681,7 @@ include $(CLEAR_VARS) LOCAL_SRC_FILES:=$(framework_docs_LOCAL_SRC_FILES) LOCAL_INTERMEDIATE_SOURCES:=$(framework_docs_LOCAL_INTERMEDIATE_SOURCES) -LOCAL_JAVA_LIBRARIES:=$(framework_docs_LOCAL_JAVA_LIBRARIES) framework +LOCAL_JAVA_LIBRARIES:=$(framework_docs_LOCAL_JAVA_LIBRARIES) framework framework2 LOCAL_MODULE_CLASS:=$(framework_docs_LOCAL_MODULE_CLASS) LOCAL_DROIDDOC_SOURCE_PATH:=$(framework_docs_LOCAL_DROIDDOC_SOURCE_PATH) LOCAL_DROIDDOC_HTML_DIR:=$(framework_docs_LOCAL_DROIDDOC_HTML_DIR) @@ -717,6 +734,26 @@ LOCAL_DX_FLAGS := --core-library include $(BUILD_JAVA_LIBRARY) +include $(CLEAR_VARS) + +# FRAMEWORKS_BASE_SUBDIRS comes from build/core/pathmap.mk +LOCAL_SRC_FILES := $(call find-other-java-files,$(SECONDARY_FRAMEWORKS_SUBDIRS)) + +LOCAL_NO_STANDARD_LIBRARIES := true +LOCAL_JAVA_LIBRARIES := bouncycastle core core-junit ext framework + +LOCAL_MODULE_TAGS := optional +LOCAL_MODULE := framework2 +LOCAL_MODULE_CLASS := JAVA_LIBRARIES + +LOCAL_NO_EMMA_INSTRUMENT := true +LOCAL_NO_EMMA_COMPILE := true + +#LOCAL_JARJAR_RULES := $(LOCAL_PATH)/jarjar-rules.txt + +LOCAL_DX_FLAGS := --core-library + +include $(BUILD_JAVA_LIBRARY) # Include subdirectory makefiles # ============================================================ @@ -726,3 +763,4 @@ include $(BUILD_JAVA_LIBRARY) ifeq (,$(ONE_SHOT_MAKEFILE)) include $(call first-makefiles-under,$(LOCAL_PATH)) endif
./frameworks/base/test-runner/Android.mk
LOCAL_SRC_FILES := $(call all-java-files-under, src) -LOCAL_JAVA_LIBRARIES := core core-junit framework +LOCAL_JAVA_LIBRARIES := core core-junit framework framework2 LOCAL_MODULE:= android.test.runner
直接照着做就ok了
相关推荐
huha 2020-10-16
xfcyhades 2020-11-20
sgafdsg 2020-11-04
Michael 2020-11-03
fengyeezju 2020-10-14
ziyexiaoxiao 2020-10-14
业余架构师 2020-10-09
OuNuo0 2020-09-29
moses 2020-09-22
Angelia 2020-09-11
qinxu 2020-09-10
刘炳昭 2020-09-10
Nostalgiachild 2020-09-07
Nostalgiachild 2020-08-17
leavesC 2020-08-14
一青年 2020-08-13
AndroidAiStudy 2020-08-07
ydc0 2020-07-30
绿豆饼 2020-07-28