android / nowinandroid

A fully functional Android app built entirely with Kotlin and Jetpack Compose
Apache License 2.0
16.64k stars 3.01k forks source link

Fix an uninstall app after instrumented tests problem #1531

Open Jaehwa-Noh opened 3 months ago

Jaehwa-Noh commented 3 months ago

What I have done and why

Fix #1530

https://issuetracker.google.com/issues/295039976 Add android.injected.androidTest.leaveApksInstalledAfterRun=true in gradle.properties.

dturner commented 2 months ago

Whilst this retains the original behavior of not uninstalling the demoDebug APK if it was previously installed, I wonder whether uninstalling the APK after an instrumented test is actually a problem.

In the past we've had problems with CI emulators running out of disk space, largely due to APKs not being uninstalled. I don't want to run into that again. The new behavior of uninstalling the demoDebug APK (created for the instrumented tests or not) might actually be better for this project.

Is there a specific reason why having demoDebug uninstalled is a problem?

Jaehwa-Noh commented 2 months ago

@dturner Oh, I'd not followed up the out of disk space issue. My target is making instrumented test app doesn't override the already installed app for using, and remove it after test done.

Why I do is, when we install the app aab or apk on device, and we've use that installed app for a while, and after that we ran the instrumented test on same device, the origin installed app was uninstalled. we need to preserve installed demoDebug or whatever build variables to still remain on the device, for not install new initialized app again.

So that, I think we need to separate the installed app from the instrumented test app.

If the out of disk space problem is bigger than this, I'll close this PR and the issue.

P.S I checked the CI, gradle.properties of CI will be overridden from ci-gradle.properties, It seems there no effects on CI, isn't it?

Jaehwa-Noh commented 1 month ago

@dturner Maybe the out of the space problem is related with this #1267 issue. I think the bunch of data had been inserted again and again, over again as it ran on AndroidTest.