ADT: fail to build when there are too many packages and classes

纵饮孤独 提交于 2019-12-07 21:54:51

问题


I have a big project with many library projects as well as many packages and classes in source code.

Using ADT (r20) in Eclipse (v4.2) to build, I get this error:

[2012-07-08 09:05:33 - AndroidUIPatterns] Dx trouble writing output: Too many fields: 69379; max is 65536. By package:

19 android.app
14 android.content.pm
 5 android.content.res
 2 android.gesture
39 android.graphics
 8 android.graphics.drawable
13 android.os
 3 android.provider

...
...
[2012-07-08 09:05:33 - AndroidUIPatterns] Conversion to Dalvik format failed with error 2

For full error log, your can see it here: http://pastie.org/4218297

It seems there is a maximum limit for number of package / class in an Android project?

I'll appreciate all your help if anyone can tell me how to solve this error.


回答1:


It's a limitation of dx compiler that is currently limited to 65536 (2^16) field/method references per dex. It's "being fixed" since 2010.

The only solution now is to split application into multiple dex files, so no single dex file exceeds the 64k limit.



来源:https://stackoverflow.com/questions/11380179/adt-fail-to-build-when-there-are-too-many-packages-and-classes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!