Android---真机调试时不能识别手机的解决方案
我自己遇到的问题是VS2013和VS2015中xamarin无法识别到真机,现象就是插上手机开启调试模式,豌豆荚都可以连接上手机,就是VS上没出现手机。
但是低版本的手机貌似又行,4.0.3的。
于是排除了各种问题,比如手机开发这模式,数据线,ADB驱动,ANDROID SDK升级,都不行,
最后随意地点了下Restart Adb Server:
发现居然可以识别到真机了,我只能说比较神奇。。。
以下都是ADB连接问题,可以通过尝试如下步骤,由简单度排序
1. 插拔下USB连接线
2. 关闭USB模式再打开
3. 执行以下命令
- adb kill-server
- adb start-server
4. 效果与3相同
DDMS - Devices - Reset adb
5. 关闭所有PC套件,例如:
杀死 Wandoujia 相关的所有进程,ok
wandoujia_daemon.exe
wandoujia_helper.exe
7. 查看有几个ADB进程,全部杀死再重新启动ADB
8. 查看下USB先是否连接电脑与手机
9. 重启手机
10. 关闭占用5037端口软件
11. 更新adb (见问题14)
1. 查看占用端口5037的PID值
netstat -a -n -o |findstr "5037"
输出结果:
TCP 127.0.0.1:5037 0.0.0.0:0 LISTENING 5096
TCP 127.0.0.1:5037 127.0.0.1:51577 ESTABLISHED 5096
TCP 127.0.0.1:51577 127.0.0.1:5037 ESTABLISHED 4324
2. 从上面得知PID = 5096占用了5037端口,现在通过PID查看进程名,看到底哪个进程占用此端口
tasklist /v | findstr 5096
输出结果:
tadb.exe 5096 Console 1 4,932 K Unknown ...... 0:00:02 暂缺
网上查询得知tadb.exe是腾讯管家启动的进程
netstat -a -n -o |findstr "5037"
输出结果:
TCP 127.0.0.1:5037 0.0.0.0:0 LISTENING 5096
TCP 127.0.0.1:5037 127.0.0.1:51577 ESTABLISHED 5096
TCP 127.0.0.1:51577 127.0.0.1:5037 ESTABLISHED 4324
2. 从上面得知PID = 5096占用了5037端口,现在通过PID查看进程名,看到底哪个进程占用此端口
tasklist /v | findstr 5096
输出结果:
tadb.exe 5096 Console 1 4,932 K Unknown ...... 0:00:02 暂缺
网上查询得知tadb.exe是腾讯管家启动的进程
3. 杀死占用5037端口的进程 tadb.exe
taskkill /f -pid 5096
taskkill /im tadb.exe
输出结果
成功: 已终止 PID 为 5096 的进程。
taskkill /f -pid 5096
taskkill /im tadb.exe
输出结果
成功: 已终止 PID 为 5096 的进程。
问题1
- The connection to adb is down, and a severe error has occured.
- You must restart adb and Eclipse.
- Please ensure that adb is correctly located at 'adb.exe' and can be executed.
问题2
- ADB server didn't ACK
- * failed to start daemon *
问题3
- Adb failed to restart! Make sure the plugin is properly configured
问题4
- ** Adb connection Error:远程主机强迫关闭了一个现有的连接
问题5
- java.io.IOException: 您的主机中的软件中止了一个已建立的连接。
- at sun.nio.ch.SocketDispatcher.write0(Native Method)
- at sun.nio.ch.SocketDispatcher.write(Unknown Source)
- at sun.nio.ch.IOUtil.writeFromNativeBuffer(Unknown Source)
- at sun.nio.ch.IOUtil.write(Unknown Source)
- at sun.nio.ch.SocketChannelImpl.write(Unknown Source)
- at com.android.ddmlib.JdwpPacket.writeAndConsume(JdwpPacket.java:213)
- at com.android.ddmlib.Client.sendAndConsume(Client.java:575)
- at com.android.ddmlib.HandleHeap.sendREAQ(HandleHeap.java:348)
- at com.android.ddmlib.Client.requestAllocationStatus(Client.java:421)
- at com.android.ddmlib.DeviceMonitor.createClient(DeviceMonitor.java:854)
- at com.android.ddmlib.DeviceMonitor.openClient(DeviceMonitor.java:822)
- at com.android.ddmlib.DeviceMonitor.processIncomingJdwpData(DeviceMonitor.java:781)
- at com.android.ddmlib.DeviceMonitor.deviceClientMonitorLoop(DeviceMonitor.java:649)
- at com.android.ddmlib.DeviceMonitor.access$100(DeviceMonitor.java:42)
- at com.android.ddmlib.DeviceMonitor$3.run(DeviceMonitor.java:577)
通常是同时打开了两个eclipse,关闭一个即可
问题6
- Failed to install .apk on device '': Unable to open sync connection!
- java.io.IOException: Unable to open sync connection!
- Launch canceled!
- ADB rejected shell command (rm /data/local/.apk): closed
- Error during Sync: Unable to open sync connection!
- Error during Sync: Unable to open sync connection!
- Adb connection Error:远程主机强迫关闭了一个现有的连接。
- Connection attempts: 1
- Connection attempts: 2
- Connection attempts: 3
问题8
- Failed to install .apk on device : Too many open files
- com.android.ddmlib.SyncException: Too many open files
- Launch failed on device:
问题9
- Failed to install .apk on device '': closed
- com.android.ddmlib.InstallException: closed
- Launch failed on device:
问题10
- Installation error: INSTALL_FAILED_INSUFFICIENT_STORAGE
- Please check logcat output for more details.
- Launch failed on device:
- Installation error: INSTALL_FAILED_UPDATE_INCOMPATIBLE
- Please check logcat output for more details.
- Launch failed on device:
使用PC套件删除,然后安装不行,通过adb uninstall 再次删除,安装ok
- Android Launch!
- Connection with adb was interrupted.
- 0 attempts have been made to reconnect.
- You may want to manually restart adb from the Devices view.
- Unexpected error while launching logcat. Try reselecting the device.] closed
- om.android.ddmlib.AdbCommandRejectedException: closed
- at com.android.ddmlib.AdbHelper.executeRemoteCommand(AdbHelper.java:381)
- at com.android.ddmlib.Device.executeShellCommand(Device.java:462)
- at com.android.ddmuilib.logcat.LogCatReceiver$1.run(LogCatReceiver.java:109)
- at java.lang.Thread.run(Unknown Source)
问题14
- adb server is out of date. killing...
- * daemon started successfully *
- error: device offline
- D:\>adb version
- Android Debug Bridge version 1.0.29
- D:\>adb version
- Android Debug Bridge version 1.0.31