在Ionic框架中为Android启用Multidex



有没有办法设置enable multidex(https://github.com/casidiablo/multidex)对于Android,如果我使用Ionic Framework构建应用程序?

对于那些仍然有这个问题的人,我已经通过安装cordova插件multidex 来修复它

cordova plugin add cordova-plugin-enable-multidex

查看:Cordova 的Multidex

有一个插件可以启用multidex。要安装它,请运行:

cordova plugin add --save https://github.com/jwall149/cordova-multidex

然后尝试重新构建。构建可能需要比平时长一点的时间,但你的应用程序应该可以顺利编译。

对于使用androidxcordova-android: 8的人对此解决方案感兴趣,我创建了一个支持这些新版本的文件结构和类名的fork。也适用于Ionic。

cordova plugin add --save https://github.com/c00/cordova-multidex

请注意,只有当您仍然支持小于21的minSdk时,这才是相关的。21岁时,不再需要多出口,因为它有一些内置的修复程序。因此,在这种情况下,只需删除多出口插件(如果你有),一切都会正常工作。

试试这个

cordova plugin add --save https://github.com/jwall149/cordova-multidex
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

https://medium.com/@AnkitMaheshwariIn/ionic-android-error-while-merge-dex-in-ionic-3f6272899ab

最新更新