can anyone tell me if multi dex is supported in android 2.3?
I've searched around but i can't find information for this. My project have the same configuration like this one: https://github.com/mustafa01ali/MultiDexTest
The project builds without problem, but the final apk can't be installed in devices with 2.3 or lower.
On installation I get the error
Failure [INSTALL_FAILED_DEXOPT]
in Android Studio and this appears in logcat:
E/dalvikvm﹕ LinearAlloc exceeded capacity (5242880), last=1384
W/installd﹕ DexInv: --- END '/data/app/xxx.apk' --- status=0x000b, process failed
E/installd﹕ dexopt failed on '/data/dalvik-cache/data@[email protected]@classes.dex' res = 11
You're hitting a different size limitation (LinearAlloc), which according to this bug is not solved by multi-dex:
https://code.google.com/p/android/issues/detail?id=78035
From comment #7 in that bug:
There is already an option in dx allowing to force generation of smaller dex files: --set-max-idx-number= Unfortunately changing the default is not a solution since the linearAlloc limit can be reached at very different levels depending on the classes hierarchy and other criteria.
In addition for most applications, moving to multidex will only help to workaround the linearalloc limit for the installation. But the application will still crash against the same limit at execution. The only working use case where I know multidex can help with linearalloc is when the apk does not contains one application but distinct pieces running in separate process.
It's not clear that there's anything you can do to work around this limit, at least in the long term; you may need to simplify your app. There's another StackOverflow question here with some information and some workarounds that may get you up and running, at least for a while:
How to avoid LinearAlloc Exceeded Capacity error android
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With