Ionic cordova build android --prod giving nightmares


#1

My working project stopped and stuck at copy finieshed in…

Finally after trying everything i thought its better to create a blank new project and transplant my 52 pages,components,directives [ its a big project] to this new project.

I am in the middle of this, now i have started getting this error

Execution failed for task ‘:app:transformDexArchiveWithExternalLibsDexMergerForDebug’.

I am on IONIC 3 , below is ionic info of the project

cli packages: (C:\Users\jessica\AppData\Roaming\npm\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.9
    Cordova Platforms  : none
    Ionic Framework    : ionic-angular 3.9.2

System:

    Android SDK Tools : 25.2.5
    Node              : v6.10.3
    npm               : 6.0.1
    OS                : Windows 8.1

Environment Variables:

    ANDROID_HOME : C:\Program Files (x86)\Android\android-sdk

When this error comes, i follow below 5 steps to correct it

  1. Remove the platform: ionic cordova platform remove android
  2. Delete the following folders from your app folder: platforms,plugins & www
  3. Make sure your dependencies are available by running: npm install
  4. Add back the platform, this step will recreate the folders deleted in step 2 above: ionic cordova platform add android
  5. Finally, build your app: ionic cordova build android --prod

After these 5 steps, build is made, but why i have to do this everytime ??