11

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

Deepzz
  • 4,573
  • 1
  • 28
  • 52
Derek Johnson
  • 812
  • 5
  • 6

2 Answers2

8

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.

David Cohen
  • 429
  • 2
  • 4
6

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.

Diamond
  • 7,428
  • 22
  • 37
  • 3
    Wow that was fast, trying it now – Derek Johnson Dec 14 '15 at 05:32
  • 3
    I learnt that recently `android.includeGPlayServices` has been default to true. Even if you don't add the build hint, it would be used where needed. To turn it off, set it to false. – Diamond Dec 14 '15 at 05:36