如何使用ADB在设备上安装现有的Android应用程序? [英] How to install over existing Android app on device using adb?

查看:152
本文介绍了如何使用ADB在设备上安装现有的Android应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在开发过程中,我使用

$ adb -s 192.168.1.77:5555 uninstall com.myApp.app

$ adb -s 192.168.1.77:5555 install /path/to/android-debug.apk

卸载现有应用程序,然后将更新的应用程序推送并安装到我的设备上。但是,这似乎会擦除与该应用程序关联的现有数据,因此,每次我运行更新后的应用程序时,都需要再次输入新数据。但是,只需运行install命令即可:

to uninstall the existing app, then push and install the updated app to my device. However, this seems to erase my existing data associated with the app so that each time I run the updated app I need to input the new data again. However, simply running the install command gives:

[ 10%] /data/local/tmp/android-debug.apk
[100%] /data/local/tmp/android-debug.apk
    pkg: /data/local/tmp/android-debug.apk
Failure [INSTALL_FAILED_ALREADY_EXISTS]

使用iOS,您只需在设备上的现有应用上安装更新的应用即可。

With iOS you can simply install your updated app over the existing app on the device.

最好使用 adb 等效于Android?

What is the equivalent for Android preferably using adb?

编辑:这个问题确实是类似于这个,但我认为应该保留,因为我的方式问题的措辞将帮助许多试图从不同角度(即重新安装/覆盖与更新的角度)得到答案的人。

This question is really similar to this one, but I think this should be kept because the way my question is phrased will help many people trying to find an answer that are coming from a different angle– the angle being of reinstalling/overwriting versus updating.

推荐答案

来自 adb --help

adb install [-lrtsdg] <file>
        - push this package file to the device and install it
         (-l: forward lock application)
         (-r: replace existing application)
         (-t: allow test packages)
         (-s: install application on sdcard)
         (-d: allow version code downgrade (debuggable packages only))
         (-g: grant all runtime permissions)

因此,您只需添加 -r 选项

$ adb -s 192.168.1.77:5555 install -r /path/to/android-debug.apk

这篇关于如何使用ADB在设备上安装现有的Android应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆