Android Tutorial MultiDex - Solves the too many methods error

B4A v6.8 adds support for MultiDex compilation.

Enabling MultiDex:
B4X:
'main module
#MultiDex: True

With MultiDex enabled, the compiled classes are split into multiple dex files as needed.

When to do use it?

Only if you encounter one of the following errors during compilation:
- Too many field references
- Too many method references


There are issues with MultiDex and Android 2.x devices, however these devices are now less relevant: https://developer.android.com/about/dashboards/index.html

B4A v6.80

Developers who use this version should replace the existing Dexer.jar with this one: www.b4x.com/android/files/Dexer.jar

Close the IDE and copy the updated Dexer.jar to the installation folder. It fixes an issue with Android 4 and the MultiDex feature.

Tips

- Don't use this feature if not needed. Compilation will be a bit slower and there are no benefits.
- Test your APK on an Android 4.x device. There is no native support for MultiDex on Android 4.x so the process is more fragile.
 
Last edited:

mrred128

Active Member
Licensed User
Longtime User
There are probably more 2.x devices out there than google would know. They have been prevented from actively participating in the store and cloud infrastructure for quite some time now.

Even the 4.04 devices I have (2) are supposed to be about the same percentage in their charts. I have a few clients that still use that vintage.
 
Top