--prod --release build no longer works

Hello guys,

I have a new problem with --prod --release build command.
When I try to build an apk file using this command on any project, it will just hang at "copy finished in … "
I tested it on a brand new project and it works.
My current project is edited from ionic conference demo app. I didn’t do anything so complicated.
How can I fix this?

Thanks,

1 Like

Webpack can take 1 hour or more if you have a big project and lots of pages, so be patient and see if it finishes.

If that’s not issue then check your memory usage, you may have to manually specify that your build can take 8GB of memory, the default maxes out at 1.5 or 2 GB which isn’t sufficient for some projects and requires changes. More info on this is available on the ionic github repo.

1 Like

I’ll try to be patient. Nothing happens even after 15 mins.

Unfortunately my current laptop has only 10GB RAM memory. I’m buying more RAM cards.

and switching to SSD could certainly help.

10 GB of RAM is plenty for any Ionic project so you don’t need to buy more. If your build is constrained by memory you’ll know because it will throw an error.

I don’t think an SSD will speed anything up for you since the webpack is memory and CPU intensive and has nothing to do with disc read/write speeds… they’re nice to have but it won’t affect your work on ionic apps.

1 Like

I need some help here:

Yes,
ionic cordova build android --aot --minifyjs --minifycss --release
can still build an APK but it takes over 25 minutes.

@jamesharvey I read your post yesterday and remember it has happened to me once or twice - but it was fine if I closed down the command window and tried again.

There are three possible causes:

  1. Your computer is faulty.
  2. The code that builds Ionic is hitting an endless loop.
  3. Your code in the app is causing a loop.

Computer fault: I assume you have a windows 10 pc- there was a major update recently which happens in the background. Have a look at the task manager and see what is happening with the computer’s resources. Also, check that the hard drive is OK - it could be that there is little free space left?

Code fault with Ionic: It could be one of the add-ins in the node_module folder is the cause. Try deleting the folder node_modules and then do npm update to get the versions from the web.

Faults with the app: Start with a new app from Ionic and add back items from your build one at a time (followed by prod release build). This should at least isolate the item which is causing the fault.

1 Like

Thanks,

I’m sticking with
ionic cordova build android --aot --minifyjs --minifycss --release
which creates the same production build APK.

ionic cordova build android --production --release will take forever. I waited over 30 minutes but nothing happens.
This is strange because ionic lab and ionic cordova run android both work fine.

Other people have the same problem with --prod build and they’re also using --aot --minifyjs --minifycss --release as a solution:

The APK file created with --aot --minifyjs --minifycss --release is exactly the same as the one built with --prod. It has shorter loading time and smaller file size.

This looks like some kind of bug with android version requirement because so many people have this problem and they’re not able to find any solution besides using --aot --minifyjs --minifycss --release

2 Likes

ionic cordova build android --aot --minifyjs --minifycss --release

bit of an old post now, but I just want to confirm the line above works really well as a replacement for --prod, thanks!! I’ve been searching for this solution for days.

2 Likes