adbkit icon indicating copy to clipboard operation
adbkit copied to clipboard

Is it possible to install apk without the option '-r'?

Open thinkhy opened this issue 8 years ago • 2 comments

When install apk using adbkit.install(serial, apk), it will push the apk to temp dir then install it with the shell command pm install -r remote_apk_file . But in my case the errors such as "Signature conflicts", "UID changes" and "Package downgrade" were encountered sometimes on a few devices, so I changed the code in adbkit/lib/adb/command/host-transport/install.js:

                 this._send("shell:pm install -r " + (this._escapeCompat(apk)));
            ==>
                this._send("shell:pm install  " + (this._escapeCompat(apk))); 

Now the apk can be installed successfully for almost all the devices. Is there any other(elegant) way instead of changing code to install apk without the option '-r'? Thanks.

thinkhy avatar Nov 12 '17 14:11 thinkhy

We need to allow flags to be passed it, then it can go away. Hoping someone could make a PR for that.

Sounds unlikely that those errors went away just by removing the -r flag, though.

sorccu avatar Nov 12 '17 14:11 sorccu

I will try to make a PR this weekend :-)

Now I first clear app data and unisntall pkg, then install the apk, all the code is written with adbkit. It might be due to incomplete cleaning after uninstall pkg on some devices.

thinkhy avatar Nov 14 '17 15:11 thinkhy