Reputation: 21733
My issue is similar to this question however the app is deployed.
Currently on Windows when I click run in the Android Studio Gradle starts building as expected and says completed (sometimes completed with 1 warning and sometimes, depending on the situation I may get a dialog about uninstalling the previous APK)
Then the activity launches on the device or emulator as expected, but when I start testing it becomes obvious that the newest changes are not deployed. Either the installation has silently failed or an old APK from the build cache has been deployed.
I have instant run switched off but usually do not uninstall the app between running my changes, except where I have changed branches (Git) and Android Studio has told me the versions are incompatible.
Usually if the system gets into this state the only thing that helps is Invalidate Caches/ Restart
This is a hard issue to track, has anybody else encountered it and had success in preventing it?
Upvotes: 7
Views: 1625
Reputation: 21733
I have not found a way to prevent this, but the following seems to work to ensure the correct APK is always installed:
If you skip cleanBuildCache it fails. Clean alone doesn't appear to do enough.
I'm still looking for a better answer - post if you have one
Upvotes: 1