Converting to Ionic 4, but old Ionic 3 pages appear

I am converting an existing Ionic 3 app to Ionic 4. The first time I run the app on an Android emulator, I get the new Ionic 4 app. The second time I run the same app, I get the Ionic 3 app!

I did the conversion by starting with a new Ionic 4 starter project, generating new pages etc and then migrating the content into the new pages from the Ionic 3 app.

I build the new app with ionic cordova build android and it generates an APK: platforms/android/app/build/outputs/apk/debug/app-debug.apk

I install the APK on an emulator with adb install -r platforms/android/app/build/outputs/apk/debug/app-debug.apk

Then, as I described, the first time the app runs, it shows the new Ionic 4 app. I know it’s the new app because I’ve added “Ionic 4” to the top nav toolbar. Then if I dismiss the app and run it again, I get the old Ionic 3 app come up instead. It’s not even the current version of the Ionic 3 app - it’s some older version of the app. I don’t know where it’s getting this old source from.

If I uninstall the app and re-install it, I again get the new Ionic 4 app one time only before it goes back to the Ionic 3 app.

I’ve tried:

  • Creating a brand new emulator, so the Ionic 3 app has never been installed on it. No change.
  • Removing and re-adding the android platform. No change.
  • Checked that the pages are definitely only in my project once (so I don’t have version 3 and 4 pages together).
  • Tried debug and release builds. No change.

Any thoughts? I’m running out of ideas.