androidandroid-studiogoogle-playapkgoogle-play-services

Installing new version of Android app on a previous device always reverts to the old version


I have seen similar questions to this, but without a full explanation and none with a sufficient answer.

I am building my apps in Android Studio using the Generate Signed Bundle/APK option (I am building APKs, not bundles) and using the same key each time I build. I update both the versionCode and the versionName in build.gradle every time I update my apps (and I have examined the built Android Manifest to ensure that the versionCode does change). Note that I do not use the Google Play Store and I install these apps straight from the APK files.

Whenever I install the APK on a device that has never used that app, it installs correctly with the current version. But often, when installing a new version on a device that has previously used the app, it reverts back to an old version of the app.

I have tried everything I can think of: clearing all data from the app and reinstalling, turning off app sync, clearing play store and play services cache, resetting all app preferences, etc. and I have found absolutely nothing that works to fix this except for factory resetting the entire device.

This has become extremely frustrating and Google seems to pretend that this issue does not exist at all. Any help is greatly appreciated.


Solution

  • So, after a VERY long time, I finally figured out the source of this problem. The cause of the issue has to do with the fact that I store my APKs on a website and users download the APKs from the site.

    The issue I was having was not related to Android, the Play Store, or to Android Studio, but instead by the web browser caching the downloaded APK.

    The solution was to simply make sure that each app update uses a different name for the APK file to stop the web browser from caching it.