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.
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.