Enable Multidex for Android in Ionic framework

前端 未结 5 1003
不知归路
不知归路 2021-01-13 06:30

Is there a way to set enable multidex (https://github.com/casidiablo/multidex) for Android if I build apps using Ionic Framework ?

相关标签:
5条回答
  • 2021-01-13 06:55

    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

    0 讨论(0)
  • 2021-01-13 06:57

    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.

    0 讨论(0)
  • 2021-01-13 07:07

    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.

    0 讨论(0)
  • 2021-01-13 07:15
    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-merging-dex-archives-unable-to-merge-dex-in-ionic-3f6272899aab

    0 讨论(0)
  • 2021-01-13 07:17

    Try this

    cordova plugin add --save https://github.com/jwall149/cordova-multidex
    
    0 讨论(0)
提交回复
热议问题