ADB 自动补全 及 offline 解决方法

本文介绍了解决ADB设备显示为离线状态的方法,包括检查5037端口占用情况并释放,以及如何在CMder中实现ADB命令的自动补全功能。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

补全问题:

adb 在CMD 窗口下不能补全,试了xshell 也是不能补全,最后找到 cmder 是可以补全的

下载地址: http://cmder.net/

 

adb offline 问题:

D:\Program Files\cmder_mini
λ adb shell
error: device offline

 

在进行 adb kill-server 及 adb devices 后,依然 offline

D:\Program Files\cmder_mini
λ adb kill-server

D:\Program Files\cmder_mini
λ adb devices
List of devices attached
* daemon not running. starting it now at tcp:5037 *
* daemon started successfully *
1234567890ABCDEF        offline

 

查看 5037 端口是否被占用:

D:\Program Files\cmder_mini
λ adb nodaemon server
error: could not install *smartsocket* listener: cannot bind to 127.0.0.1:5037: 通常每个套接字地址(协议/网络地址/端口
)只允许使用一次。 (10048)

D:\Program Files\cmder_mini
λ netstat -ano | findstr "5037"
  TCP    127.0.0.1:5037         0.0.0.0:0              LISTENING       3020

其中 3020 是 占用了5037端口号的程序的 pid

找到这个程序,关闭就可以了,如果无法关闭,只能重启电脑

Line 3507: 01-01 19:26:38.540 01744 01744 I adbd : persist.adb.watchdog set to '' Line 3508: 01-01 19:26:38.542 01744 01744 I adbd : persist.sys.test_harness set to '' Line 3510: 01-01 19:26:38.542 01744 01744 I adbd : adb watchdog timeout set to 600 seconds Line 3511: 01-01 19:26:38.543 01744 01744 I adbd : adbd started Line 3511: 01-01 19:26:38.543 01744 01744 I adbd : adbd started Line 3513: 01-01 19:26:38.543 01744 01759 I adbd : opening control endpoint /dev/usb-ffs/adb/ep0 Line 3514: 01-01 19:26:38.544 01744 01757 I adbd : Waiting for persist.adb.tls_server.enable=1 Line 3517: 01-01 19:26:38.554 01744 01759 I adbd : UsbFfsConnection constructed Line 3526: 01-01 19:26:38.570 01744 01761 I adbd : UsbFfs-monitor thread spawned Line 4331: 01-01 19:26:39.572 01744 01761 W adbd : timed out while waiting for FUNCTIONFS_BIND, trying again Line 4332: 01-01 19:26:39.572 01744 01761 I adbd : UsbFfs: connection terminated: monitor thread finished Line 4333: 01-01 19:26:39.573 01744 01744 I adbd : UsbFfs: already offline Line 4334: 01-01 19:26:39.573 01744 01744 I adbd : destroying transport UsbFfs Line 4335: 01-01 19:26:39.573 01744 01744 I adbd : UsbFfsConnection being destroyed Line 4353: 01-01 19:26:39.642 01744 01759 I adbd : opening control endpoint /dev/usb-ffs/adb/ep0 Line 4355: 01-01 19:26:39.648 01744 01759 I adbd : UsbFfsConnection constructed Line 4363: 01-01 19:26:39.652 01744 01965 I adbd : UsbFfs-monitor thread spawned Line 6044: 01-01 19:26:40.669 01744 01965 W adbd : timed out while waiting for FUNCTIONFS_BIND, trying again Line 6045: 01-01 19:26:40.669 01744 01965 I adbd : UsbFfs: connection terminated: monitor thread finished Line 6046: 01-01 19:26:40.670 01744 01744 I adbd : UsbFfs: already offline Line 6047: 01-01 19:26:40.670 01744 01744 I adbd : destroying transport UsbFfs Line 6048: 01-01 19:26:40.670 01744 01744 I adbd : UsbFfsConnection being destroyed Line 6641: 01-01 19:26:40.810 01744 01759 I adbd : opening control endpoint /dev/usb-ffs/adb/ep0 Line 6703: 01-01 19:26:40.815 01744 01759 I adbd : UsbFfsConnection constructed Line 6726: 01-01 19:26:40.820 01744 02220 I adbd : UsbFfs-monitor thread spawned Line 7858: 01-01 19:26:41.384 01744 02220 I adbd : USB event: FUNCTIONFS_BIND Line 12899: 01-01 19:26:45.298 02952 02958 E Diag_Lib: DPL : gIsQXDMDisabled 0, gIsADBDisabled 0, gIsDebugDisabled 0, gIsIMSLogsDisabled 0 gIsDebugDataPathDisabled = 0 Line 13319: 01-01 19:26:45.317 02952 02958 E Diag_Lib: DPL : gIsQXDMDisabled 0, gIsADBDisabled 0, gIsDebugDisabled 0, gIsIMSLogsDisabled 0 gIsDebugDataPathDisabled = 0 Line 13978: 01-01 19:26:45.534 02924 02924 D CompatConfig: No directory /apex/com.android.adbd/etc/compatconfig, skipping Line 17407: 01-01 19:26:47.093 02924 02924 W PackageManager: No package known for package restrictions com.google.android.adbd Line 17766: 01-01 19:26:47.274 02924 02924 D PackageManager: Directories scanned as system partitions: [/system:0, /vendor:524288, /odm:4194304, /oem:262144, /product:1048576, /system_ext:2097152, /my_product/non_overlay:1048576, /mnt/opex/com.oplus.odmf@15002009:2097152, /mnt/opex/com.oplus.moduleservices@15000014:2097152, /mnt/opex/com.oplus.fancyIconLoader@1000000:2097152, /mnt/opex/com.oplus.NetworkAssistSys@15002031:2097152, /mnt/opex/com.oplus.CustCore@15000029:2097152, /my_company:1048576, /my_carrier:1048576, /my_bigball:1048576, /my_product/cust/TR:1048576, /apex/com.android.ipsec:41943040, /apex/com.android.ondevicepersonalization:41943040, /apex/com.android.cellbroadcast:41943040, /apex/com.android.profiling:41943040, /apex/com.android.nfcservices:41943040, /apex/com.android.media.swcodec:41943040, /apex/com.android.conscrypt:41943040, /apex/vendor.oplus.hardware.stability.aidl:42467328, /apex/com.android.os.statsd:41943040, /apex/com.android.wifi:41943040, /apex/com.android.uwb:41943040, /apex/com.android.virt:41943040, /apex/com.android.adservices:41943040, /apex/com.android.configinfrastructure:41943040, /apex/com.android.devicelock:41943040, /apex/com.android.appsearch:41943040, /apex/com.google.mainline.primary.libs:41943040, /apex/com.android.compos:44040192, /apex/com.android.tethering:41943040, /apex/com.android.resolv:41943040, /apex/com.android.mediaprovider:41943040, /apex/com.android.runtime:41943040, /apex/com.android.neuralnetworks:41943040, /apex/com.android.permission:41943040, /apex/com.android.adbd:41943040, /apex/com.android.i18n:41943040, /apex/com.android.scheduling:41943040, /apex/com.android.media:41943040, /apex/com.android.tzdata:41943040, /apex/vendor.oplus.hardware.engineer.aidl:42467328, /apex/com.android.sdkext:41943040, /apex/com.android.rkpd:41943040, /apex/com.android.apex.cts.shim:41943040, /apex/com.android.art:41943040, /apex/com.android.extservices:41943040, /apex/com.android.vndk.v33:44040192, /apex/com.android.healthfitness:41943040] Line 17819: 01-01 19:26:47.410 02924 02924 I PackageManager: /data/apex/decompressed/com.android.adbd@351010000.decompressed.apex changed; collecting certs Line 17823: 01-01 19:26:47.422 02924 02924 E PackageManagerServiceUtilsExtImpl: Fix up user restrict data of pkg: com.google.android.adbd Line 19413: 01-01 19:26:51.224 02924 02924 D PackageManager: No files in app dir /apex/com.android.adbd/priv-app Line 19414: 01-01 19:26:51.224 02924 02924 D PackageManager: No files in app dir /apex/com.android.adbd/app Line 20634: 01-01 19:26:52.985 02924 02924 W PackageSettings: Couldn't write -1 to /config/sdcardfs/com.google.android.adbd/appid Line 21520: 01-01 19:26:53.270 02924 02924 D OverlayManager: -> Updating overlay: target=com.google.android.adbd overlays=[OverlayPaths { resourceDirs = [], overlayPaths = [/data/resource-cache/com.android.systemui-neutral-coSn.frro, /data/resource-cache/com.android.systemui-accent-n7sV.frro, /data/resource-cache/com.android.systemui-dynamic-EysW.frro] }] userId=0 Line 29901: 01-01 19:26:55.625 02924 03113 I UsbDeviceManager: failed to write to /sys/class/android_usb/android0/f_rndis/ethaddr Line 29902: 01-01 19:26:55.626 02924 03113 D UsbPortManager: Querying USB Gadget HAL version Line 29915: 01-01 19:26:55.630 02924 03113 E UsbDeviceManager: connectToProxy: usb gadget hidl hal service not found. Line 29922: at com.android.server.usb.UsbDeviceManager.<init>(UsbDeviceManager.java:332) Line 29922: at com.android.server.usb.UsbDeviceManager.<init>(UsbDeviceManager.java:332) Line 29935: 01-01 19:26:55.630 02924 03113 E UsbPortManager: USB Gadget HAL AIDL/HIDL not present Line 29936: 01-01 19:26:55.630 02924 03113 D UsbDeviceManager: getInstance done Line 29946: 01-01 19:26:55.636 02924 03113 I UsbDeviceManager: mResetUsbGadgetDisableDebounce:false connected:0configured:0 Line 29948: 01-01 19:26:55.636 02924 03113 I UsbDeviceManager: removeMessages MSG_UPDATE_STATE Line 30039: 01-01 19:26:55.647 02924 03113 D UsbPortManager: Querying USB HAL version Line 30082: 01-01 19:26:55.658 02924 03113 I UsbPortManager: USB HAL HIDL present Line 30093: 01-01 19:26:55.665 02924 03304 I UsbPortManager: Usb hal service started android.hardware.usb@1.0::IUsb default Line 30103: 01-01 19:26:55.671 02924 03113 D UsbPortManager: getInstance done Line 33157: 01-01 19:26:56.637 02924 02969 I UsbDeviceManager: handleMessage MSG_UPDATE_STATE mConnected:false mConfigured:false Line 46190: 01-01 19:26:58.809 02924 03298 D UsbDeviceManager: systemReady Line 46192: 01-01 19:26:58.810 02924 02969 D UsbDeviceManager: UsbBootInfo: [mSystemReady: true, mBootCompleted: false, mConnected: false, mConfigured: false, mCurrentUsbFunctionsReceived: true, mPendingBootBroadcast: true, mScreenLocked: true, screenUnlockedFunctions: , isAdbEnabled: true] Line 46221: 01-01 19:26:58.814 02924 03304 I UsbPortManager: ClientCallback V1_2: port0 Line 46245: 01-01 19:26:58.818 02924 02969 I UsbPortManager: USB port added: port=UsbPort{id=port0, supportedModes=dual, audio_acc, supportedContaminantProtectionModes=0, supportsEnableContaminantPresenceProtection=false, supportsEnableContaminantPresenceDetection=false, supportsComplianceWarnings=false, status=UsbPortStatus{connected=true, currentMode=ufp, currentPowerRole=sink, currentDataRole=device, supportedRoleCombinations=[source:host, sink:device], contaminantDetectionStatus=0, contaminantProtectionStatus=0, usbDataStatus=unknown, isPowerTransferLimited=false, powerBrickConnectionStatus=unknown, complianceWarnings=[], plugState=0, displayPortAltModeInfo=null}, canChangeMode=true, canChangePowerRole=false, canChangeDataRole=false, connectedAtMillis=36033, lastConnectDurationMillis=0 Line 70581: 01-01 19:27:06.142 02924 02972 V UsbDeviceManager: onKeyguardStateChanged: isShowing:true secure:false user:0 Line 72918: 01-01 19:27:07.024 02924 02924 I UsbDeviceManager: updateHostState UsbPort{id=port0, supportedModes=dual, audio_acc, supportedContaminantProtectionModes=0, supportsEnableContaminantPresenceProtection=false, supportsEnableContaminantPresenceDetection=false, supportsComplianceWarnings=false status=UsbPortStatus{connected=true, currentMode=ufp, currentPowerRole=sink, currentDataRole=device, supportedRoleCombinations=[source:host, sink:device], contaminantDetectionStatus=0, contaminantProtectionStatus=0, usbDataStatus=unknown, isPowerTransferLimited=false, powerBrickConnectionStatus=unknown, complianceWarnings=[], plugState=0, displayPortAltModeInfo=null} Line 77542: 01-01 19:27:08.412 02924 02972 D UsbDeviceManager: boot completed Line 77613: 01-01 19:27:08.420 02924 02969 D UsbDeviceManager: UsbBootInfo: [mSystemReady: true, mBootCompleted: true, mConnected: false, mConfigured: false, mCurrentUsbFunctionsReceived: true, mPendingBootBroadcast: true, mScreenLocked: false, screenUnlockedFunctions: , isAdbEnabled: true] Line 77621: 01-01 19:27:08.421 02924 02969 D UsbDeviceManager: broadcasting Intent { act=android.hardware.usb.action.USB_STATE flg=0x31100000 (has extras) } extras: Bundle[{host_connected=false, connected=false, unlocked=false, adb=true, configured=false}] Line 77637: 01-01 19:27:08.423 02924 02969 D UsbDeviceManager: setEnabledFunctions [functions= ,forceRestart=false ,usbDataUnlocked=false ,mUsbDataUnlocked=false ,operationId=6] Line 77692: 01-01 19:27:08.444 02924 02969 D UsbDeviceManager: oplusFunctions: adb Line 77696: 01-01 19:27:08.446 02924 02969 D UsbDeviceManager: UsbFunc: [functions: adb, oemFunctions: adb, mCurrentFunctionsStr: adb, mCurrentOemFunctions: adb, forceRestart: false, mCurrentFunctionsApplied: true] Line 77700: 01-01 19:27:08.446 02924 02969 D UsbDeviceManager: updateMtpFunction , mtpEnabled: false, ptpEnabled: false, mIsMtpServiceBound: false Line 77814: 01-01 19:27:08.471 01744 01758 I adbd : adbd_auth: received a new framework connection Line 77814: 01-01 19:27:08.471 01744 01758 I adbd : adbd_auth: received a new framework connection Line 77815: 01-01 19:27:08.472 01744 01758 I adbd : adbd_auth: received new framework fd 16 (current = -1) Line 77815: 01-01 19:27:08.472 01744 01758 I adbd : adbd_auth: received new framework fd 16 (current = -1) Line 81135: 01-01 19:27:09.113 04893 04893 D vold_prepare_subdirs: Setting up mode 771 uid 0 gid 1000 context u:object_r:apex_module_data_file:s0 on path: /data/misc_ce/0/apexdata/com.android.adbd Line 82329: 01-01 19:27:09.362 02924 04870 W PackageManager: Skipping preparing app data for com.google.android.adbd Line 83351: 01-01 19:27:09.715 02924 02996 V UsbDeviceManager: onKeyguardStateChanged: isShowing:false secure:false user:0 分析adb链接中断原因
最新发布
08-12
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值