仕事中のAndroidコンパイルではほとんど遭遇しない問題、インタフェースの分離

6026 ワード

trouble writing output: Too many methods: 65634; max is 65536. By package:(インタフェースが多すぎて、破れています.インタフェースの分離が必要です)26 android 145 android.accessibilityservice    700 android.accounts    436 android.animation      8 android.annotation   3796 android.app    240 android.app.admin    308 android.app.backup    105 android.appwidget   1152 android.bluetooth   1754 android.content    964 android.content.pm    566 android.content.res    522 android.database    497 android.database.sqlite     91 android.ddm      5 android.debug    166 android.drm     51 android.drm.mobile1     30 android.emoji     23 android.filterfw    817 android.filterfw.core ......
 
この問題はframeworkインタフェースが多すぎるためToo many methods:65634、Googleは当初最大655345個のインタフェースを収容することができ、Goolgeが提供するインタフェースが足りない場合、私たち自身がframeworkにいくつかのインタフェースを加える必要があります.これにより、インタフェースが65535という数字を超え、buildtargetproductcore.mk PRODUCT_への参加PACKAGESは、いくつかの余分なインタフェースを他のパケットに追加する.
方法:https://github.com/CyanogenMod/android_frameworks_base/commit/854f6f736b90d33b59b5a85bcecf72a416c43b7d
 
40  Android.mk  show inline notes 
View file @ 854f6f7 ...  ...  @@ -28,10 +28,25 @@ framework_res_source_path := APPS/framework-res_intermediates/src 
28  28    
29  29   # the library 
30  30   # ============================================================ 
   31  +# 
   32  +# These will be included in framework2 to avoid issues with the limit 
   33  +# on the number of classes/dex 
   34  +SECONDARY_FRAMEWORKS_SUBDIRS := \ 
   35  +        core/java/android/test \ 
   36  +        core/java/android/gesture \ 
   37  +        core/java/android/speech/srec \ 
   38  +        media/java/android/media/videoeditor \ 
   39  +        media/java/android/media/audiofx \ 
   40  +        media/mca/effect/java/android/media/effect \ 
   41  +        media/mca/effect/java/android/media/effect/effects 
   42  + 
31  43   include $(CLEAR_VARS) 
32  44    
33  45   # FRAMEWORKS_BASE_SUBDIRS comes from build/core/pathmap.mk 
34  46   LOCAL_SRC_FILES := $(call find-other-java-files,$(FRAMEWORKS_BASE_SUBDIRS)) 
   47  +SECONDARY_SRC_FILES := $(call find-other-java-files,$(SECONDARY_FRAMEWORKS_SUBDIRS)) 
   48  + 
   49  +LOCAL_SRC_FILES := $(filter-out $(SECONDARY_SRC_FILES),$(LOCAL_SRC_FILES)) 
35  50    
36  51   # EventLogTags files. 
37  52   LOCAL_SRC_FILES += \ 
...  ...  @@ -252,6 +267,7 @@ $(full_classes_compiled_jar): $(framework_res_R_stamp) 
252  267   $(LOCAL_INSTALLED_MODULE): | $(dir $(LOCAL_INSTALLED_MODULE))framework-res.apk 
253  268    
254  269   framework_built := $(call java-lib-deps,framework) 
   270  +framework_built += $(call java-lib-deps,framework2) 
255  271    
256  272   # AIDL files to be preprocessed and included in the SDK, 
257  273   # relative to the root of the build tree. 
...  ...  @@ -390,6 +406,7 @@ framework_docs_LOCAL_JAVA_LIBRARIES := \ 
390  406         core \ 
391  407         ext \ 
392  408         framework \ 
   409  +      framework2 \ 
393  410    
394  411   framework_docs_LOCAL_MODULE_CLASS := JAVA_LIBRARIES 
395  412   framework_docs_LOCAL_DROIDDOC_HTML_DIR := docs/html 
...  ...  @@ -664,7 +681,7 @@ include $(CLEAR_VARS) 
664  681    
665  682   LOCAL_SRC_FILES:=$(framework_docs_LOCAL_SRC_FILES) 
666  683   LOCAL_INTERMEDIATE_SOURCES:=$(framework_docs_LOCAL_INTERMEDIATE_SOURCES) 
667     -LOCAL_JAVA_LIBRARIES:=$(framework_docs_LOCAL_JAVA_LIBRARIES) framework 
   684  +LOCAL_JAVA_LIBRARIES:=$(framework_docs_LOCAL_JAVA_LIBRARIES) framework framework2 
668  685   LOCAL_MODULE_CLASS:=$(framework_docs_LOCAL_MODULE_CLASS) 
669  686   LOCAL_DROIDDOC_SOURCE_PATH:=$(framework_docs_LOCAL_DROIDDOC_SOURCE_PATH) 
670  687   LOCAL_DROIDDOC_HTML_DIR:=$(framework_docs_LOCAL_DROIDDOC_HTML_DIR) 
...  ...  @@ -717,6 +734,26 @@ LOCAL_DX_FLAGS := --core-library 
717  734    
718  735   include $(BUILD_JAVA_LIBRARY) 
719  736    
   737  +include $(CLEAR_VARS) 
   738  + 
   739  +# FRAMEWORKS_BASE_SUBDIRS comes from build/core/pathmap.mk 
   740  +LOCAL_SRC_FILES := $(call find-other-java-files,$(SECONDARY_FRAMEWORKS_SUBDIRS)) 
   741  + 
   742  +LOCAL_NO_STANDARD_LIBRARIES := true 
   743  +LOCAL_JAVA_LIBRARIES := bouncycastle core core-junit ext framework 
   744  + 
   745  +LOCAL_MODULE_TAGS := optional 
   746  +LOCAL_MODULE := framework2 
   747  +LOCAL_MODULE_CLASS := JAVA_LIBRARIES 
   748  + 
   749  +LOCAL_NO_EMMA_INSTRUMENT := true 
   750  +LOCAL_NO_EMMA_COMPILE := true 
   751  + 
   752  +#LOCAL_JARJAR_RULES := $(LOCAL_PATH)/jarjar-rules.txt 
   753  + 
   754  +LOCAL_DX_FLAGS := --core-library 
   755  + 
   756  +include $(BUILD_JAVA_LIBRARY) 
720  757    
721  758   # Include subdirectory makefiles 
722  759   # ============================================================ 
...  ...  @@ -726,3 +763,4 @@ include $(BUILD_JAVA_LIBRARY) 
726  763   ifeq (,$(ONE_SHOT_MAKEFILE)) 
727  764   include $(call first-makefiles-under,$(LOCAL_PATH)) 
728  765   endif 
   766  + 

 
2  test-runner/Android.mk  show inline notes 
View file @ 854f6f7 ...  ...  @@ -20,7 +20,7 @@ include $(CLEAR_VARS) 
20  20    
21  21   LOCAL_SRC_FILES := $(call all-java-files-under, src) 
22  22    
23     -LOCAL_JAVA_LIBRARIES := core core-junit framework 
   23  +LOCAL_JAVA_LIBRARIES := core core-junit framework framework2 
24  24    
25  25   LOCAL_MODULE:= android.test.runner 
26  26    

変換元:http://blog.csdn.net/wzy0467/article/details/7970681