Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error When building a large Codename One Application During the Dex Phase

I got an error in the build server when sending an Android build during the dex phase.

Googling a bit I learned that there is a hard limit of 64K functions (including all libs, the heaviest is google play services), or you can use the multiple dex mechanism.

How do I activate this for Codename One?

I understand Codename One uses Ant and as far as I understand this only works for gradle.

FYI this is the workaround, that splits google play services into sub libraries with native android:

http://android-developers.blogspot.com.es/2014/12/google-play-services-and-dex-method.html

like image 466
Derek Johnson Avatar asked Dec 14 '15 05:12

Derek Johnson


2 Answers

I had a very similar issue and corresponded with Codename One's pro support on this. Gradle support was something they just recently announced so its not as documented but should be available in the next update.

You need to add the following build hints to your project:

android.gradle=true 
android.multidex=true

I understand that gradle will be the default build once 3.3 rolls around so in the future only the multidex option will be needed.

like image 87
David Cohen Avatar answered Nov 20 '22 07:11

David Cohen


You don't have to add Google Play Service Library in your codenameone app, just add android.includeGPlayServices=true to your build hint and it would be included in build server.

like image 45
Diamond Avatar answered Nov 20 '22 07:11

Diamond