Build android production release apk packages old code


#1

I am following this deploy documentation: https://ionicframework.com/docs/intro/deploying/ for android. When I build and sign my apk, it contains old code from a previous build instead of my latest code changes.

Does anyone know how to fix this? I am not getting any errors or compile issues, everything builds successfully but it just does it with old code.

Things I’ve tried:

  • Removing and re-adding the android platform
  • Running sudo cordova prepare in my project root
  • Incremented my app version in config.xml
  • Running Ionic serve before building an apk prod package

Nothing has worked, I always see the old code on my production build. When I do Ionic serve -l, it shows the latest code.

Has anyone come across this issue and solved it?


#2

What exact commands are you executing?
Do you have any update services like Ionic Pro Deploy or Codepush in your app?
What is your ionic info output?


#3

Solved it using:
ionic cordova build android --prod
Running it first without --release seems to have updated everything.