I built an android project that set up with android-maven-plugin. When I execute android:deploy and run the program, SharedPreferences always initialized.
Is there a way to deploy my project to AVD without deleting SharedPreferences storage?
P.S.
I use Intellij IDEA and noticed that its native android run/debug support does not delete SharedPreferences. However, after I add scala support on my project, IDE reports "Too many methods: 112423; max is 65536" error when I run the application. Perhaps it is due to lack of proguard preprocessing. If there are a way to apply proguard before run the android app with Intellij IDEA android support, it would be an equally effective solution.
I think your app is being uninstalled before being reinstalled again - this would cause you to lose your SharedPreferences values. This can be controlled with the Android Maven plugin parameter undeployBeforeDeploy.
I just tried to create a Maven project with the android-quickstart archetype and found that it automatically added the following line to my POM:
<undeployBeforeDeploy>true</undeployBeforeDeploy>
Try to set this to false and try again.
If you have it set to true, it prints this line in the console when you run mvn android:deploy
:
[INFO] Successfully uninstalled [package] from [device]
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