I need to delete a shared preferences file using an adb command. Is there a way to do that without uninstalling the app?
I could not find anything that did it?
Clearing shared preferences To clear all the values in the shared preferences file, call the clear() method on the shared preferences editor and apply the changes. SharedPreferences.
The data stored in SharedPreferences can be edited and deleted.
To remove the app go into your Android device's shell by running adb shell . Once there, run pm uninstall -k --user 0 package.name (replacing package.name with the name of the package you searched for earlier). You can also run adb shell pm uninstall -k --user 0 package.name if you choose.
If you want to clear all the preferences, a single command will do it:
adb shell pm clear <package name>
Definitely not on an unrooted phone. On normal consumer builds (user builds), only the application itself can access the app's data.
If you have root, you can access the shell via
adb shell
Then navigate to the app's data directory (/data/data/<package name>
), find the file and rm
it.
Alternatively, you can do it all at once with
adb shell rm /data/data/<package name>/<file name>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With