-
Notifications
You must be signed in to change notification settings - Fork 545
Try to preserve the app cache on uninstall. #10019
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Can we make |
the |
note that the very first call to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was looking what "fast deployment" does for this in Debug mode, and I can only find the pm
command:
Should we only use the pm
command here instead of trying two commands? Just to make Debug & Release consistent?
We can also update this target, which is maybe not used:
android/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets
Lines 3017 to 3030 in 747041d
<Target Name="_Uninstall"> | |
<AndroidAdb | |
ToolExe="$(AdbToolExe)" | |
ToolPath="$(AdbToolPath)" | |
AdbTarget="$(AdbTarget)" | |
Command="uninstall" | |
Arguments="$(_AndroidPackage)" | |
/> | |
</Target> | |
<Target Name="Uninstall" | |
Condition="'$(AndroidApplication)'!='' And $(AndroidApplication)" | |
DependsOnTargets="$(UninstallDependsOnTargets)"> | |
</Target> |
So just use the |
You might review what |
Context #9259 Due to various reasons `adb` may not be able to preserve the app cache on uninstall. To work around this we have to use the `-k` flag to uninstall the app when using the `cmd package uninstall` call. This will keep the app data and cache on the device. However this might also fail. So in that case we need to completely uninstall the app and then install it again.
253bf0a
to
34f59f6
Compare
@jonathanpeppers I went with just calling |
@jonathanpeppers looks like it broke a re-install aab test though |
<AndroidAdb | ||
Condition=" '$(EmbedAssembliesIntoApk)' == 'true' " | ||
ContinueOnError="True" | ||
ToolExe="$(AdbToolExe)" | ||
ToolPath="$(AdbToolPath)" | ||
AdbTarget="$(AdbTarget)" | ||
Command="uninstall" | ||
Arguments="-k $(_AndroidPackage)" | ||
Command="shell cmd package uninstall -k" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if this should instead be adb shell pm uninstall -k PACKAGE
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
…as I'd never heard of adb shell cmd
before now, and it's not listed at e.g. <adbshell.com>.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't notice it's doing adb shell cmd package uninstall -k
.
android-platform-support looked like it was doing adb shell pm uninstall -k
, so let me just change to that and let's see what CI says?
Context #9259
Due to various reasons
adb
may not be able to preserve the app cache on uninstall. To work around this we have to use the-k
flag to uninstall the app when using thecmd package uninstall
call. This will keep the app data and cache on the device.However this might also fail. So in that case we need to completely uninstall the app and then install it again.