Android-maven-plugin: deployment method that does not remove SharedPreferences

I built an android project configured with Android-maven-plugin. When I run android: deploying and running the program, SharedPreferences is always initialized.

Is there a way to deploy my project to AVD without deleting the SharedPreferences repository?

PS

I am using Intellij IDEA and noticed that its support / debugging support for Android does not remove SharedPreferences. However, after adding scala support to my project, the IDE reports "Too many methods: 112423; max - 65536" when running the expression. Perhaps this is due to the lack of pre-processing proguard. If there is a way to apply proguard before running an android application with Intellij IDEA android support, this would be an equally effective solution.

+6
source share
1 answer

I think that your application is uninstalled before reinstalling - this will lead to the loss of SharedPreferences. This can be controlled using 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 to false and try again.

If you set it to true, it prints this line in the console when you run mvn android:deploy :

 [INFO] Successfully uninstalled [package] from [device] 
+2
source

Source: https://habr.com/ru/post/927142/


All Articles