Skip to content

Commit 7224d61

Browse files
author
sourakov
committed
Patch from origin repo:
49dea51 Luke Inman-Semerau on 26.10.15 at 20:56 (committed on 26.10.15 at 22:20) actually uninstall... adb install -r doesn't seem to actually work all the time. Fixes #994
1 parent 5dd07d1 commit 7224d61

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

changelog.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
0.18.0-SNAPSHOT (under current development)
2-
---
3-
1+
0.17.1
2+
-------------------
3+
- uninstall before installing, since adb install -r doesn't appear to work correctly all the time [#994](../../issues/994)
44

55
0.17.0
66
---

selendroid-standalone/src/main/java/io/selendroid/standalone/android/impl/AbstractDevice.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,13 @@ public boolean isInstalled(AndroidApp app) throws AndroidSdkException {
127127

128128
@Override
129129
public void install(AndroidApp app) throws AndroidSdkException {
130-
// Reinstall if already installed, Install otherwise
131-
CommandLine command = adbCommand("install", "-r", app.getAbsolutePath());
130+
// Uninstall if already installed
131+
if (isInstalled(app)) {
132+
uninstall(app);
133+
}
134+
// -r: replace existing application
135+
// -d: allow version code downgrade
136+
CommandLine command = adbCommand("install", "-rd", app.getAbsolutePath());
132137

133138
String out = executeCommandQuietly(command, COMMAND_TIMEOUT * 6);
134139
try {

0 commit comments

Comments
 (0)