0

Ionic cordova build android successfully but with --release failed

i try cordova clean Change cordova platform version

apply app/build.gradle

android { defaultConfig {

    minSdkVersion 21
    targetSdkVersion 28 
    multiDexEnabled true

} }

$ ionic info cli packages: (C:\Users\AMIT-PC\AppData\Roaming\npm\node_modules)

@ionic/cli-utils  : 1.19.0
ionic (Ionic CLI) : 3.19.0

global packages:

cordova (Cordova CLI) : 9.0.0 (cordova-lib@9.0.1)

local packages:

@ionic/app-scripts : 3.2.4
Cordova Platforms  : android 8.0.0
Ionic Framework    : ionic-angular 3.1.1

System:

Android SDK Tools : 25.2.5
Node              : v8.9.4
npm               : 5.6.0
OS                : Windows 10

Environment Variables:

ANDROID_HOME : F:\Android\android-sdk

Misc:

backend : pro

$ ionic cordova requirements

cordova requirements

Requirements check results for android:

Java JDK: installed 1.8.0 Android SDK: installed true Android target: installed android-29,android-Q,android-28,android-27,android-26,android-25 Gradle: installed F:\Android\gradle-5.5\bin\gradle

$ ionic cordova build android

BUILD SUCCESSFUL in 3s 42 actionable tasks: 42 up-to-date Built the following apk(s): F:\trans4mrz\platforms\android\app\build\outputs\apk\debug\app-debug.apk

$ Ionic cordova build android --release

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ':app:transformDexArchiveWithDexMergerForRelease'.

    com.android.build.api.transform.TransformException: java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives: Learn how to resolve the issue at https://developer.android.com/studio/build/dependencies#duplicate_classes. Program type already present: org.apache.cordova.BuildHelper

  • Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 5s [ERROR] An error occurred while running cordova build android --release (exit code 1).

  • Possible duplicate of [org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:transformClassesWithDexForDebug'](https://stackoverflow.com/questions/37583875/org-gradle-api-tasks-taskexecutionexception-execution-failed-for-task-apptra) – SimonC Jul 02 '19 at 10:51
  • Thank you for Reply With ionic cordova build android --debug successfully Build . But when i try to build with release the above error show – Unnati Mistry Jul 02 '19 at 12:12
  • @Unnati Mistry I have this exact same issue with --release not working. Did you find a soultion yet? – Dave Sep 26 '19 at 11:29

0 Answers0