Is there a way to set enable multidex (https://github.com/casidiablo/multidex) for Android if I build apps using Ionic Framework ?
-
View, I things same problem [Cordova - Multiple dex files define (annotation)](http://stackoverflow.com/questions/31727318/cordova-multiple-dex-files-define-annotation/33777507#33777507) – Anurag Pandey Dec 14 '15 at 06:58
5 Answers
For those still having this issue, I've fixed it by installing cordova-plugin-multidex
cordova plugin add cordova-plugin-enable-multidex
Check it out: Multidex for Cordova

- 464
- 9
- 17
There is a plugin that enables multidex. To install it, run:
cordova plugin add --save https://github.com/jwall149/cordova-multidex
And try building again. The build may take a little longer than usual, but your app should compile without troubles.

- 1,870
- 2
- 25
- 43
-
1I think the correct command would is: `cordova plugin add --save https://github.com/jwall149/cordova-multidex` – Lucas D'Avila Nov 26 '17 at 03:25
-
-
-
1@MoblizeIT the package mentioned in my answer hasn't been updated in 2+ years. I suggest you try another package, or do a clean build. – Grayda Dec 07 '19 at 05:02
For people using androidx
and cordova-android: 8
is interested in this solution, I created a fork that supports the file structure and class names of these new versions. Also works with Ionic.
cordova plugin add --save https://github.com/c00/cordova-multidex
Note that this is only relevant if you are still supporting a minSdk
less than 21. At 21, multidexing is no longer needed as there is some built-in fix for it. So in that case, just remove the multidex plugin (if you had it) and things should work.

- 1,842
- 3
- 19
- 37
Try this
cordova plugin add --save https://github.com/jwall149/cordova-multidex

- 153
- 1
- 8
To fix this —
Install couple of androidx plugins to solve the issue. So simply run the following commands in your project root:
Add plugin to enable AndroidX in the project
1. ionic cordova plugin add cordova-plugin-androidx
2. Add plugin to patch existing plugin source that uses the Android Support Library to use AndroidX
ionic cordova plugin add cordova-plugin-androidx-adapter
3. Now run the following commands in your project root:
cordova clean
ionic cordova build android

- 5,071
- 41
- 33