Error creating my apk with cordova

My ionic app in browser works perfect, but in android has a fail when I try to compile or build the apk.

If I execute “ionic cordova run android --l --verbose” I have the following error:

Error: E:\ionic\myApp\platforms\android\gradlew: Command failed with exit code 1 Error output:
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
D8: Program type already present:

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ‘:app:transformDexArchiveWithExternalLibsDexMergerForDebug’. Error while merging dex archives:
Learn how to resolve the issue at
Program type already present:

  • 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

BUILD FAILED in 2m 20s
at ChildProcess.whenDone (E:\ionic\myApp\node_modules\cordova-common\src\superspawn.js:135:23)
at ChildProcess.emit (events.js:210:5)
at ChildProcess.cp.emit (E:\ionic\myApp\node_modules\cross-spawn\lib\enoent.js:34:29)
at maybeClose (internal/child_process.js:1021:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)

I’ve been searching about the error, and I’ve tried the following things.

  • Remove android platform and create again.
  • Add to build.gradle multiDexEnabled true .
  • Clear cordova cache.

None of the above worked.

Anyone can help me please?

I ran into this before and running cordova clean android worked for me

Yes, I tried that also, but not working.

Hi, remove you android platform than create with this command:
ionic cordova platform add android@8.0.0
After than go to Platform -> Android -> build.gradle than do Gradle version to 3.0.1

It has not worked. I still have the same error.

What is your Cordova version?

Version 9.0.1

   Cordova CLI       : 9.0.0 (cordova-lib@9.0.1)
   Cordova Platforms : android 8.0.0, browser 6.0.0
   Cordova Plugins   : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 4.1.3, (and 19 other plugins)