Pm install -r failing (Android device)

We want to be able to upgrade our apk on our Android device when we start appium.

Doing this manually, I would use "adb install -r ". I notice Lookout uses adb pm install -r . There appears to be some behavior differences for these two commands – notice this output:

wosser$ adb shell pm install -r ~/builds/my.apk
pkg: /Users/wosser/builds/my.apk
Failure [INSTALL_FAILED_INVALID_URI]

wosser$ adb install -r !$
adb install -r ~/builds/my.apk
2917 KB/s (8173856 bytes in 2.736s)
pkg: /data/local/tmp/my.apk
Success

I’ve seen some oddness in the past with Android, for example, “adb logcat” and “adb shell logcat” do not behave the same on all devices. I wonder if anyone knows anything about this behavior for Android. I also wonder if there is any reason “shell pm install -r” was chosen instead of “install -r”.

install -r spends a considerable amount of time pushing the apk to the device. pm install will install an on device apk. If pm install fails then that’s a bug and I recommend opening an issue on GitHub.

this wouldn’t ever happen in appium because we push the apk on device and then issue pm install using the on device path and a hash of the apk.

I only ran it manually because this is the error that I get when I run this through Appium and I wanted to isolate this from Appium itself. I’ll run this test later and post the server logs.

Ok, make sure to do that as an issue on GitHub. The devs won’t see the bug here.

Sure enough, when I tried this again, the problem did not manifest itself. I’ll keep an eye out for the failure and grab the server logs next time it happens.