Couldn't build Android


#1

Hi,
I have been trying to solve this problem and in vain, please help.
When try to build android, this error occured:

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ‘:app:transformDexWithDexForRelease’.

com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexException: Multiple dex files define Lorg/apache/cordova/BuildHelper;

My environment:

cli packages: (/Users/xxxxxxxx/Desktop/IonicProjects/XXXXX/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 : 1.3.12
Cordova Platforms  : android 7.0.0
Ionic Framework    : ionic-angular 3.5.0

System:

Android SDK Tools : 26.1.1
ios-deploy        : 1.9.2
Node              : v8.9.4
npm               : 5.6.0
OS                : macOS High Sierra
Xcode             : Xcode 9.3.1 Build version 9E501

Environment Variables:

ANDROID_HOME : /Users/XXXXXX/Library/Android/sdk

Misc:

backend : pro

Please help, thanks in advance.


#2

I had the same problem until today. I think it has something todo with firewall settings.

I removed android studio completly and did a fresh install. I using windows for development, it seems to me, that you are using mac os or linux.

After this i did a cleanup with ccleaner and a restart.

After the fresh install i removed the sdk for android 8.1 and installed only 8.0. after this i did a ionic build and i get a firewall request for java. I activated all zones and now its building again. Perhaps some information could help to deal with this problem.

Greetings
Marcus


#3

Hi,
Thank you.
I have other apps can build successfully, only this won’t work.
Will give it a try.


#4

Ohh sorry answered to wrong post O_o


#5

@soo Try adding the below plugin and rebuild

cordova plugin add cordova-android-support-gradle-release


#6

Hi,
Weird. I try to build again without adding any code or plugin, everything is working now.
Thanks for your help.