In my application some changes in the code is not reflecting in the application if I re-install the application. It only reflects when I uninstall and install the app again. The device I'm using is samsung F21 FE (Android version 13). It seems like device is maintaining the cache memory.
I created the viewmodel in common for all screens and which I want to use it in the baseActivity. I injected the viewmodel in the acitivities using dagger 2. Even after the application is killed the viewmodel is maintaing the old data, viewmodel is not cleared on onDestroy of baseActivity.(https://i.stack.imgur.com/YT6lk.png)
(https://i.stack.imgur.com/LKr8f.png)
(https://i.stack.imgur.com/wjrAM.png)
I just tried to creating a viewmodel in common for all the BaseActivity. All activities in the application extends BaseActivity. But the viewmodel data are not cleared even after the application is killed.
Happened to me as well, In my case it is not the issue of the device caching basically, happens with the multiple devices and emulator as well even after i remove the xml file or any code from the project as well. The android studio is maintaining the cache data in my case. I tried below steps to resolve the same.
Step 1 :- Clean and build again.
Step 2 :- Invalid cache and restart.
Step 3 :- Uninstall android studio and reinstall again.
Step 4 :- Uninstall the android studio by root. Follow this guide or any other guide which have the commands to remove the same. Make sure all necessary things will get removed from your system like .gradle , .idea , sdk , ndk and other necessary file which contains all programs related to the android development.
Step 5 :- System maintaining conflicts with android studio so the last option is, reset the system and install the studio again.
In my case i had done everything to resolve but the last option for me is to reset the system and i again installed the Android studio. Now it works like a charm.