Ionic build --prod stuck at "copy finished in"

Hello guys,

I’m trying to build an apk file from my project.

I used ionic cordova build android --release --prod to build but it always get stuck at “copy finished in”

I’m using cordova 7.0.0 so I downgraded it to 6.3.0. The result was the same.
I created a brand new ionic project and migrated src folder and re-installed all npm packages. It still gets the same error.

What should I do? I find it to be strange becauseionic lab, ionic cordova run android both work fine. It can build debug apk file and I see no problem with this app on android emulator.


1_ so in your log it’s written “copy finished in…” and then it doesn’t release right?

2_ have you check if all permissions (chown / chmod) are correct for folder .platforms/android/app/build/outputs/apk/release? did you find something there?

3_ don’t ask me why, have you try

 ionic cordova build android --prod --release

instead of

 ionic cordova build android --release --prod


4_ have you try cordova-android@7.1.0 (latest)? when you do saw, do you update or remove/add your platform? I suggest remove/add

5_ which cordova cli version are you using? Are you using the last one v8.0.0?

1 Like

I edited and it started working!


All version numbers were 12… I changed it to 11 and everything works.

I guess there’s some version issue going on with cordova and google play services.

1 Like

Cool to hear you found the solution :slight_smile:

Yep these versions often lead to incompatibility depending of locale settings and dependencies between plugins, therefore more and more plugins (like push or facebook) allows their users to specify them with a variable at install time

1 Like

Yes… I can’t believe I spent over three hours with this problem.
I thought there was problem in my coding. is in android folder. version 12 seems to be unstable yet. 11.+ will work fine.

If it fails at cordova build time, there is most than probably no error in your coding respectively no compilation errors in your bundle typescript code if you used the flag --prod

three hours, not bad, I could even say that’s quick, I remember having lost all days for such things :wink:

1 Like

Try this

ionic cordova build android --prod --release

If the problem still exsits try removing the platform and adding it again

ionic cordova platform rm android

ionic cordova platform add android

Here’s my new file:


this problem is happening again… I’m unable to build apk with any command. --release, --prod --release, --aot --minifyjs --minifycss --release all don’t work. They all hang at “copy finished in” …
How can I fix this issue?

found any solution ? I am too facing the same issue and this is so frustrating…

Try to omit --minifyjs

--aot --minifycss --release

will still build a fairly useful build although it’s going to be a little slower on Android.

on iOS, you don’t need --prod build. --release build will still build a fast app.
on Android, you’ll need to minify at least css if --prod doesn’t work. --release build will be take 10 seconds to load.

I think cordova is more unstable on android. on iOS, it works well without this kind of issues although Apple app store is a headache to deal with.

if nothing works, start a brand new project, transplant your src and re-install all plugins and build again.

I started a brand new project, it was building fine, but now i am facing this error Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.

I am so tired, i feel like leaving ionic forever.

Do you use firebase? That might be the problem:

1 Like

I use firebase but angular fire is not included in this project.
firebase provide json urls for my app … and any other server can do the same.

I think the issue is related to android library versions in file.
No one knows a solution yet

cordova clean android should do the trick.

1 Like

If you are using angularfire2 for firebase, it seems that you will have to downgrade both angularfire2 and firebase to a “Known working version”

This did the trick for me:

npm i --save firebase@4.12.1
npm i --save angularfire2@5.0.0-rc4

More info at

In your case, this seems to be happening because of a dependency for latest versions of the firebase package, try to use a version prior to 4.13 to get your app working fine.


I solved this by downgrading only my firebase database module

npm uninstall @firebase/database
npm install @firebase/database@0.2.1

now my project build.



This solves my problem! Thank you!


This solved my issue. Thanks for saving my time.

This solved my problem. Thank you very much!!!

This was related to the firebase library. Thank you !