问题描述
Some time ago I had trouble with my Huawei P30 and ADB/Android Studio installing APKs.事实证明我正在使用过时版本的库/工具。解决了,愉快地继续前进。
现在我的手机已升级到Android 10,我面临的问题与以前非常相似,但是我似乎无法以相同的方式来解决(通过更新库)。我尝试安装每种工具的多个版本,进行Android Studio和Android相关工具的全新安装,但似乎无济于事。
Android Studio
当前行为是Android Studio生成APK只是为了以后无限期地卡在“安装”步骤中。在少量测试中,它会失败。
ADB
我还尝试使用adb
从命令行安装APK,但结果不一。
$ adb version
Android Debug Bridge version 1.0.41
Version 30.0.4-6686687
运行Android Studio时,安装该应用程序要么失败,要么无限期挂起,就像在Android Studio中一样:
$ cd .../platform-tools
$ adb start-server
* daemon not running; starting now at tcp:5037
* daemon started successfully
$ adb install C:\...\example.apk
Performing Streamed Install
adb: failed to install C:\...\example.apk
$ adb install C:\...\example.apk
Performing Streamed Install
^^^ Hangs there forever
现在,事情变得有趣了,如果我关闭Android Studio,则安装APK大约50%的时间会成功安装(另一半安装失败并重新启动电话连接):
$ cd .../platform-tools
$ adb kill-server
$ adb start-server
* daemon not running; starting now at tcp:5037
* daemon started successfully
$ adb install C:\...\example.apk
Performing Streamed Install
adb: failed to install C:\...\example.apk
$ adb kill-server
$ adb start-server
* daemon not running; starting now at tcp:5037
* daemon started successfully
$ adb install C:\...\example.apk
Performing Streamed Install
Success
$ adb kill-server
$ adb install C:\...\example.apk
* daemon not running; starting now at tcp:5037
* daemon started successfully
Performing Streamed Install
Success
$ adb kill-server
$ adb install C:\...\example.apk
* daemon not running; starting now at tcp:5037
* daemon started successfully
Perform
adb: failed to install C:\...\example.apk
我可以轻松执行其他操作,例如将文件推送到手机中或卸载应用程序。到目前为止,该问题仅与安装APK有关:
$ adb shell pm uninstall com.example
Success
$ adb push C:\...\app-debug.apk /sdcard/APKs
C:\Dropbox...\app-debug.apk: 1 file pushed,0 skipped. 15.2 MB/s (31131771 bytes in 1.956s)
为什么安装应用程序失败或成功,就像掷硬币一样?这可能是驱动程序问题吗? Android Studio如何干扰单独运行adb工具的成功率?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)