Hello
I’m struggling with appium test wrapped with webdriver IO and after tests, installation file *apk, gets deleted. There’s no log regarding, no setting. I don’t understand why this is happening.
Is there any settings related to such action? This is really inconvenient for me.
It might be the same bug as in APK file being deleted after appium completes test run · Issue #797 · appium/appium-uiautomator2-driver · GitHub
Make sure both the driver and the server are up to date
@mykola-mokhnach thanks a lot! You’re a saver ![]()
Using absolute location path for apk fixed the problem. Hope the issue will be fixed soon.
Deleted from the target, or deleted from the test machine? What, is the reason you don’t want the apk deleted/removed from the target after the test?
I’m only asking, because I hit this issue years ago and have worked around it, because we also wanted the apk to stay on the target, and keen to know if our decision to do that was really healthy @Agata_Ciesielska . Oh and welcome to the Appium user forums ![]()
APK gets deleted after failed or aborted test run – fixed by upgrading uiautomator2 (Appium 2)
Hi all,
I would like to share our findings because we ran into exactly the same issue and were able to reproduce and prove the root cause.
Problem
In our local Appium setup, the APK file referenced via appium:app was physically deleted from disk after:
-
long-running test suites (>3h)
-
external service failures (SOAP/Webservice timeouts)
-
manual abort of the test run after multiple failures
The APK was not moved or renamed – it was deleted.
Other APKs in the same folder were untouched.
Proof
We enabled Windows file system auditing and confirmed via Windows Security Event 4663 that:
-
the APK was deleted with DELETE access
-
the responsible process was:
C:\Program Files\nodejs\node.exe
So this was clearly Node/Appium cleanup logic, not Java code, not Maven, not scripts, and not antivirus.
Our Setup (before fix)
-
Appium 2.19.0
-
Appium Java Client 9.4.0
-
Node.js 22.21.1
-
Android 13+, real devices
-
Local execution (no CI)
Root Cause
After some research (including this thread), we realized that our uiautomator2 version was outdated and incompatible with our Appium 2 / Java Client setup.
In certain failure or abort scenarios, Appium treated the APK as a temporary artifact and removed it during cleanup.
Fix
Upgrading uiautomator2 solved the issue completely:
uiautomator2: 2.12.6 → 4.2.9
Since this upgrade:
-
no APK deletion anymore
-
stable behavior even on test failures or manual aborts
-
no other changes required in our framework
Conclusion
If you see APKs being deleted after failed or aborted test runs with Appium 2, check your uiautomator2 version.
An outdated uiautomator2 server can trigger incorrect cleanup behavior via Node.js.
Hope this helps others who run into the same issue.
Best regards
Guido