Repository navigation
adb server 起不来时留下原因;安卓开好而 adb 没登记上时补登记;补全组件挪目录被占时重试再复制 - #113
Merged
Merged
Conversation
有用户新建实例时,私有 adb server 开机前后一直监听不上,安卓 72 秒就开好了,管理器却等满
300 秒才报「安卓没有启动完成」,原因无从查起;补全组件那边,Google Play 商店的目录刚写完
就挪不动(拒绝访问),连着三次都一样。
- 私有 adb server 的日志写到 logs\adb-server.log(Env 里设 ANDROID_ADB_LOG_PATH,模拟器
自己调 adb 时起的 server 也写这里),超过 2 MB 起新 server 前换成 .1。
- server 起了却没监听上:报出这份日志的最后几行;同样的内容只报一次。
- 本进程起来过的 server 不见了:报它是已经退出,还是还在但不监听了,附上日志最后几行。
- 等开机时,模拟器报告安卓开机完成(avd\mas_<i>.avd\bootcompleted.ini 不比 qemu 旧),
adb 却还连不上:
- 每 10 秒替它向私有 adb server 登记一次(RegisterBooted)。模拟器只在开机结束时登记那
一次,server 是那以后才起来或重启过的,就再也看不到这台实例。
- 60 秒后仍连不上就不再等,报「安卓已经开好了,但私有 adb 一直用不了」,带上 adb 日志
的最后一行;等满总时限时也这样报。
- 补全组件把解好的目录挪进 sdk 时,在 Windows 上遇到拒绝访问、共享冲突,重试 30 秒;还
不行就复制过去再删 staging。只有挪进 sdk 这一步会复制,挪开已有目录、放回原处都只重试。
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Nov 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
为什么
有用户在一台装了安全软件的电脑上用 0.39.0 新建实例,连着四次失败:
sdk\playstore就报拒绝访问,连着三次都这样。多半是有程序(安全软件扫刚写出的 APK)把文件开着没放。用户那边的根本原因(谁让 adb 起不来、谁把它结束了)现在还查不到。这个 PR 做三件事:让这种情况下次能直接看出原因;能自己恢复的情况就恢复;挪目录被占时不再直接失败。
改了什么
Env里设了ANDROID_ADB_LOG_PATH,私有、脚本两个 adb server 的日志都写进logs\adb-server.log,不再混进%TEMP%\adb.log。模拟器开机结束时自己调 adb、顺手起的 server 也写这里。日志超过 2 MB,下次起 server 前换成.1。logs\adb-server.log和它的.1。文件不在就不提,旧版本的目录里没有这个文件。avd\mas_<i>.avd\bootcompleted.ini,而且这个文件不比 qemu 旧。模拟器启动时会删掉它,开机完成时再写出来。RegisterBooted)。模拟器只在开机结束时登记那一次;server 如果是之后才起来的或者重启过,就再也看不到这台实例。以前等开机时,对自己刚启动的实例从不重新登记。TestFetchPutsOldDirBack原来测的就是「文件被占着、挪不进去」,现在这种情况会改用复制装上。所以改成「复制也失败」再测放回旧目录,另加TestFetchCopiesHeldDirIn测改用复制能装上。测试
Env、同样内容只报一次、发现 server 已退出或不再监听。bootcompleted.ini的新旧判断。TestCollectManagerLogsAdbAndPorts加上了adb-server.log。go test ./...;go vet(windows / darwin / linux)。bootcompleted.ini的时间、不分错误类型都重试、没开 copyFallback 也复制、复制失败留下半个目录、每次都报、server 还在也报已退出、Env不设日志路径、日志不轮转)。start。46 秒开好;logs\adb-server.log有了,里面是 adb 37.0.1 的启动记录。platform-tools\adb.exe的进程),一直结束到bootcompleted.ini出现后 2 秒,让模拟器开机结束时那一次登记落空。结果 55 秒开好: