最新消息:20210917 已从crifan.com换到crifan.org

【已解决】Mac中用adb install安装安卓apk卡死

安卓 crifan 2275浏览 0评论
折腾:
【未解决】批量测试安卓游戏:ViVo的Game的搜魔幻且是即时战斗类的游戏20201201
期间,遇到:Python代码中调用
os.system("adb -s {0} install -r {1}".format(self.device, item[3]))
触发 adb install去安装
log输出:
[201201 14:18:09][AppCrawler.py 77 ] start to crawl app 0 gmdl_光明大陆 com.netease.gmdl.vivo, remain 1
[201201 14:18:09][DevicesMethods.py 4062] start to install app in 20201201_fengyun_0556GuangMingDaLu_gameApp_Android.txt
Performing Streamed Install
然后就卡死了。
在此之前,已经正常安装过很多过apk,正常使用了很多天,都没问题。
且之前偶尔也遇到问题,试过:
  • 安卓手机
    • 拔插USB数据线
    • 重启
  • 更换USB数据线
  • Mac上
    • USB数据转接头
      • 重新拔插USB
    • VSCode
      • 重启VSCode
基本上都可以解决问题。
但是此处这些能试的方法都试了,却还是不行。
注:早上还正常
中午也就暂停了调试代码,没动其他的东西啊。
去看看,是否adb安装卡死有解决办法
adb install stuck
android – ADB commandline Hanging during install (PhoneGap) – Stack Overflow
说是USB数据线问题。
但是早上和之前很多天测试都没问题。
且刚也换了USB数据线,问题依旧。
an arbitrary combination of ADB kill-server, restarting the device, and re-installing SDKs seems to alleviate the problem
去试试,kill adb
✘ xxx@xxx  ~/Downloads  adb kill-server
xxx@xxx  ~/Downloads  adb devices
* daemon not running; starting now at tcp:5037
* daemon started successfully
List of devices attached
hmucaei75ptk7szs    device
再去试试
问题依旧。
重启Mac,结果:问题依旧。
有人是新升级安卓系统,所以取消USB授权,重新拔插和运行,即可。去试试
撤销:
重新拔插,允许:
难倒是:安卓手机中,内部install的空间满了?无法被push过去了?
截至目前,原因未知,无法解决。
后记:
看到:
android – ADB commandline Hanging during install (PhoneGap) – Stack Overflow
“Had the same (original) issue (with cordova / testing on an old device) ie. hang during install.
Tried running adb install directly from cmd line …
adb [-s <deviceID>] install <apk>
…and same issue so not cordova specific….
Opened android device monitor (ADM) …
..sdk\tools>monitor
..and ran install from cmd line again and saw logcat message saying package was sdk 16 / device was 15…doh!
So went back to AndroidManifest.xml and changed android:minSdkVersion to 15 and all back to normal again – install worked fine.”
那去看看此处是否是这种问题
先去看看,是否有monitor可用
~  monitor --version
Error Loading DDMS Preferences
无法输入和选择。放弃。
 ~  monitor
Error Loading DDMS Preferences
^C2020-12-01 15:42:44.880 monitor[4185:237424] -[NSApplication isRunning]: unrecognized selector sent to instance 0x100103ca0
那单独去看看此处的apk的信息:
 ~/Downloads/pre_download  aapt dump badging 20201201_fengyun_0556GuangMingDaLu_gameApp_Android_0.apk
package: name='com.netease.gmdl.vivo' versionCode='1015234' versionName='1.503824.511409' platformBuildVersionName='8.0.0' compileSdkVersion='23' compileSdkVersionCodename='6.0-2438415'
install-location:'auto'
sdkVersion:'14'
targetSdkVersion:'26'
uses-permission: name='android.permission.WRITE_EXTERNAL_STORAGE'
。。。
other-services
supports-screens: 'small' 'normal' 'large' 'xlarge'
supports-any-density: 'true'
locales: '--_--' 'cn' 'de' 'en' 'es' 'ja' 'ja-JP' 'ko' 'ko-KR' 'pt' 'ru' 'th' 'tr' 'vi' 'zh-CN' 'zh-HK' 'zh-TW'
densities: '120' '160' '240' '320' '480' '640'
native-code: 'armeabi-v7a'
  • sdkVersion:’14’
  • targetSdkVersion:’26’
那去看看此处安卓手机的版本
  • android 9
SDK 平台版本说明  |  Android 开发者  |  Android Developers
代号、标记和 Build 号  |  Android 开源项目  |  Android Open Source Project
  • targetSdkVersion:’26’
    • 26 = android 8
所以排除手机版本太旧的原因
【后记 20201202】
折腾:
【未解决】批量测试安卓游戏:ViVo的Game的搜魔幻且是即时战斗类的游戏20201202
在给:
https://gameapkbddl.vivo.com.cn/appstore/developer/soft/20190304/201903041150507083634.apk
下载到,重命名后的apk去adb install,结果又卡死了
或许是USB线松了?重新拔插USB线
拔插2次,出现USB模式,继续,问题依旧。
VSCode重新启动虚拟环境调试,问题依旧。
然后去看看:
【部分解决】尝试减少adb install整体命令的长度去解决adb install安装安卓apk卡死
然后是:重新拔插USB数据线,确保弹框显示和选择USB模式,可以继续安装了
但是导致后续出错:
【已解决】Mac中adb安装apk报错:adb failed to instal INSTALL_FAILED_CONFLICTING_PROVIDER Package couldn’t be installed because provider name is already used
说明短路径是有效的。保留短路径方案。
不过后续其他问题:
【已解决】Mac用ATX测试安卓手机更换USB转接口导致USB连接不稳定
【后记2】
折腾:
【未解决】批量测试安卓游戏:ViVo的Game的搜魔幻且是即时战斗类的游戏20201202
期间,在adb install
task/20201202_fengyun_0155MoLongShiJie/20201202_fengyun_0155MoLongShiJie_gameApp_Android/mlsj_魔龙世界.apk
时,又卡死了:
Performing Streamed Install
adb: failed to install /var/folders/gt/5868sbcd1jq4rxvryqhy2_1sz8n0s3/T/tmp8iuaj2ku/20201202_fengyun_0155MoLongShiJie_gameApp_Android_0.apk: [201202 17:05:45][AppCrawler.py 109] crawl mlsj/魔龙世界 start
[W 201202 17:05:45 watcher:181] already started
[201202 17:05:45][DevicesMethods.py 151] start com.snailgames.dragonrevolt.vivo
[201202 17:05:45][AppCrawler.py 90 ] package "com.snailgames.dragonrevolt.vivo" not found
显示安装了。但是实际上没安装。然后后续报错了。
换长路径,试试
好像的确会卡死。。
换短路径,再试,结果还是失败:
adb: failed to install /var/folders/gt/5868sbcd1jq4rxvryqhy2_1sz8n0s3/T/tmp5_5tmahs/20201202_fengyun_0155MoLongShiJie_gameApp_Android_0.apk:
后续依旧卡死。
换个USB线,还是卡死
去看看是否有其他方式去把apk用adb命令安装到安卓手机中
android adb install apk command
Android 调试桥 (adb)  |  Android 开发者  |  Android Developers
* -f:在内部系统内存上安装软件包。
去加上-f试试
先换个质量更好的USB线,试试 
结果adb找不到安卓设备了,重启安卓手机
始终找不到安卓设备,放弃此数据线
换回自己的USB数据线,问题依旧。
另外
Performing Streamed Install
android – What is, “performing streamed install” – Stack Overflow
加上之前:
android – Install an apk file from command prompt? – Stack Overflow
adb shell pm install -t -r "/data/local/tmp/com.my.awesome"
想去试试 shell pm的
adbInstallCmd = "adb shell pm install -s {0} -f {1}".format(self.device, curApkFile)
结果:
报错:
Error: Unable to open file: hmucaei75ptk7szs
Consider using a file under /data/local/tmp/
Error: Can't open file: hmucaei75ptk7szs


Exception occurred while executing:
java.lang.IllegalArgumentException: Error: Can't open file: hmucaei75ptk7szs
        at com.android.server.pm.PackageManagerShellCommand.setParamsSize(PackageManagerShellCommand.java:328)
        at com.android.server.pm.PackageManagerShellCommand.runInstall(PackageManagerShellCommand.java:906)
        at com.android.server.pm.PackageManagerShellCommand.onCommand(PackageManagerShellCommand.java:158)
        at android.os.ShellCommand.exec(ShellCommand.java:103)
        at com.android.server.pm.PackageManagerService.onShellCommand(PackageManagerService.java:21917)
        at android.os.Binder.shellCommand(Binder.java:629)
        at android.os.Binder.onTransact(Binder.java:527)
        at android.content.pm.IPackageManager$Stub.onTransact(IPackageManager.java:2809)
        at com.android.server.pm.PackageManagerService.onTransact(PackageManagerService.java:4035)
        at android.os.Binder.execTransact(Binder.java:726)
看来不能用旧的 shell pm
其会拷贝文件到:
/data/local/tmp/
但却没权限?,而报错
android – How to install an apk in one of the connected devices through adb? – Stack Overflow
How to install an APK file on an Android phone? – Stack Overflow
 (‘-s’ means install on SD card instead of internal storage)
看到了:
“* –install-location location:使用以下某个值设置安装位置:
    * 0:使用默认安装位置。
    * 1:在内部设备存储上安装。
    * 2:在外部介质上安装。”
所以去试试:
去看了看,感觉是:
貌似外部是sd卡,空间更大?
TODO:
不管了,先去试试:
--install-location 1
--install-location 2
分别试试效果
看看能否增加安装成功率
此处暂时先去:让安卓手机中手动下载和安装apk吧。
抽空再继续折腾。
然后抽空去:
【未解决】Python中如何通过adb或其他命令操作安卓手机设备内部下载apk文件再内部安装apk文件
Android Studio stuck at installing APK, the adb sometimes fails to install the APK, and somehow Android Studio interferes with adb’s install command – Stack Overflow
抽空去确保 此处Mac中的adb 是最新版本?
或许升级了最新的adb,就解决了此处的 stream install的卡死问题?
所以先去:
【已解决】给Mac中adb升级到最新版本
折腾:
【未解决】批量测试安卓游戏:ViVo的Game的搜魔幻且是即时战斗类的游戏20201203
期间,又报错:
201203 14:21:13][DevicesMethods.py 4108] Run length=154, command: adb -s hmucaei75ptk7szs install -r /var/folders/gt/5868sbcd1jq4rxvryqhy2_1sz8n0s3/T/tmpo8ky8ffq/20201203_fengyun_0004YingXiongYuMoFa_gameApp_Android_0.apk
Performing Streamed Install
adb: failed to install /var/folders/gt/5868sbcd1jq4rxvryqhy2_1sz8n0s3/T/tmpo8ky8ffq/20201203_fengyun_0004YingXiongYuMoFa_gameApp_Android_0.apk: [201203 14:21:24][AppCrawler.py 109] crawl yxymf/英雄与魔法 start
[W 201203 14:21:24 watcher:181] already started
[201203 14:21:24][DevicesMethods.py 151] start com.lr.yxymf.vivo
[201203 14:21:24][AppCrawler.py 90 ] package "com.lr.yxymf.vivo" not found
所以还是尽量先去解决此处adb的问题。
现在已升级adb到最新版:
【已解决】给Mac中adb升级到最新版本
版本最新的是:30.0.5
 xxx@xxx  ~  adb --version
Android Debug Bridge version 1.0.41
Version 30.0.5-6877874
Installed as /Users/xxx/dev/tools/android/adb/platform-tools/adb
也能检测到安卓手机设备了:
xxx@xxx  ~  adb devices
List of devices attached
hmucaei75ptk7szs    device
再回去测试adb install看看是否还经常卡死
此处通过升级adb到最新版本,貌似暂时解决了adb install apk卡死的问题
待后续长期验证,是否真的完全解决。
后记:
已回复:
android – Error: ADB exited with exit code 1 Performing Streamed Install – Stack Overflow
和:
Android Studio stuck at installing APK, the adb sometimes fails to install the APK, and somehow Android Studio interferes with adb’s install command – Stack Overflow

转载请注明:在路上 » 【已解决】Mac中用adb install安装安卓apk卡死

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
90 queries in 0.190 seconds, using 23.42MB memory