I'm developing an Android app that requires multiple libraries (for Facebook, Google Maps v2 and Quickblox among others), resulting in a method amount overflow that goes over the 64K limit:
Unable to execute dex: method ID not in [0, 0xffff]: 65536
Conversion to Dalvik format failed: Unable to execute dex: method ID not in [0, 0xffff]: 65536
As I can't do without any of those libraries, I looked for a solution for the method limit bug. I found a popular blog entry from Android Developers, where a source code division is recommended. (The blog entry I'm talking about can be found here: http://android-developers.blogspot.com.es/2011/07/custom-class-loading-in-dalvik.html). I've been trying this solution with no success.
The problem I have now is that the biggest amount of code is not in my app itself, but in the required libraries, so I have to spread those libraries among the different dex files I must load in my app. My knowledge of Ant is very limited, and what I'd like to know is what I should write in my build.xml file to make dex copy each library where I want:
<!-- Primary dex to include my source code and some libraries. -->
<copy todir="${out.classes.absolute.dir}.1" >
<fileset dir="${out.classes.absolute.dir}" >
...
</fileset>
</copy>
<!-- Secondary dex to include some other libraries. -->
<copy todir="${out.classes.absolute.dir}.2" >
<fileset dir="${out.classes.absolute.dir}" >
...
</fileset>
</copy>
Any help would be truly appreciated. Thanks in advance, kind regards!