Help with BUILD FAILED Android Ionic

I tried with “cordova clean”, but I did not work.

Somebody could help me with another solution.

Thanks,

MY IONIC INFO

cli packages: (/Users/wilfredonoyola/workspace/statusfy/sf-ionic-1/node_modules)

    @ionic/cli-utils  : 1.19.2
    ionic (Ionic CLI) : 3.20.0

global packages:

    cordova (Cordova CLI) : 8.0.0 

local packages:

    @ionic/app-scripts : 3.1.10
    Cordova Platforms  : android 7.0.0
    Ionic Framework    : ionic-angular 3.9.2

System:

    Android SDK Tools : 26.1.1
    ios-deploy        : 1.9.2 
    Node              : v6.11.3
    npm               : 3.10.10 
    OS                : macOS High Sierra
    Xcode             : Xcode 9.4.1 Build version 9F2000 

Environment Variables:

    ANDROID_HOME : /Users/wilfredonoyola/Library/Android/sdk/

Misc:

    backend : pro

cordova clean for the win, AFTER adding the multiDexEnabled true to the platform/android/build.gradle file.

1 Like

Thanks this worked for me too.

npm i cordova-plugin-multidex Helped for me

Thanks @codiqa100051260, You helped me. I was getting this error after removing a cordova plugin.

Thanks for this. It was all I needed do to. I didn’t have to update the build.gradle file.

As with @virendrashakya, it was after I had removed, then updated a cordova plugin. It was related to the ionic webview vulnerability recently reported. Although Android isn’t affected, I thought I’d better just rebuild my Android version anyway.

thank you .It worked for me too

this worked for me: cordova plugin add --save https://github.com/jwall149/cordova-multidex

as found at https://stackoverflow.com/questions/34259679/enable-multidex-for-android-in-ionic-framework

Thank you. cordova clean command saves my day.

Great!, it worked for me too.

For anyone having this problem after updating their cordova and ionic versions to latest, I fixed this by adding the minSdk and targetSdk versions to the config.xml:

    <platform name="android">
        <preference name="android-minSdkVersion" value="21" />
        <preference name="android-targetSdkVersion" value="28" />

I chose 21 as it seems after that min version, the multidex thing isn’t an issue any more when running:

ionic cordova build android

and

ionic cordova build android --prod

However, when I add the --release flag, it still errors. Will update when I have the fix for that.

Hope this helps.

1 Like

Thanks! @daveshirmancandc you saved my day! :slight_smile:

I switched from

<preference name="android-minSdkVersion" value="19" />

to

<preference name="android-minSdkVersion" value="21" />

After that my android app successfully build