Android---真机调试时不能识别手机的解决方案

来源:互联网 发布:sql anywhere 12 下载 编辑:程序博客网 时间:2024/05/01 04:36
以下都是ADB连接问题,可以通过尝试如下步骤,由简单度排序
1. 插拔下USB连接线
2. 关闭USB模式再打开
3. 执行以下命令
[plain] view plaincopyprint?在CODE上查看代码片派生到我的代码片
  1. adb kill-server  
  2. adb start-server    

4.  效果与3相同
DDMS - Devices - Reset adb

5. 关闭所有PC套件,例如:
杀死 Wandoujia  相关的所有进程,ok
wandoujia_daemon.exe
wandoujia_helper.exe


6. 重启Eclipse
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是腾讯管家启动的进程


3. 杀死占用5037端口的进程 tadb.exe
taskkill /f -pid 5096
taskkill /im tadb.exe
输出结果
成功: 已终止 PID 为 5096 的进程。



问题1 
[java] view plaincopyprint?在CODE上查看代码片派生到我的代码片
  1. The connection to adb is down, and a severe error has occured.  
  2. You must restart adb and Eclipse.  
  3. Please ensure that adb is correctly located at 'adb.exe' and can be executed.  



问题2
[java] view plaincopyprint?在CODE上查看代码片派生到我的代码片
  1. ADB server didn't ACK  
  2. * failed to start daemon *  


问题3
[plain] view plaincopyprint?在CODE上查看代码片派生到我的代码片
  1. Adb failed to restart! Make sure the plugin is properly configured  



问题4
[plain] view plaincopyprint?在CODE上查看代码片派生到我的代码片
  1. ** Adb connection Error:远程主机强迫关闭了一个现有的连接  


问题5
[plain] view plaincopyprint?在CODE上查看代码片派生到我的代码片
  1. java.io.IOException: 您的主机中的软件中止了一个已建立的连接。  
  2.       at sun.nio.ch.SocketDispatcher.write0(Native Method)  
  3.       at sun.nio.ch.SocketDispatcher.write(Unknown Source)  
  4.       at sun.nio.ch.IOUtil.writeFromNativeBuffer(Unknown Source)  
  5.       at sun.nio.ch.IOUtil.write(Unknown Source)  
  6.       at sun.nio.ch.SocketChannelImpl.write(Unknown Source)  
  7.       at com.android.ddmlib.JdwpPacket.writeAndConsume(JdwpPacket.java:213)  
  8.       at com.android.ddmlib.Client.sendAndConsume(Client.java:575)  
  9.       at com.android.ddmlib.HandleHeap.sendREAQ(HandleHeap.java:348)  
  10.       at com.android.ddmlib.Client.requestAllocationStatus(Client.java:421)  
  11.       at com.android.ddmlib.DeviceMonitor.createClient(DeviceMonitor.java:854)  
  12.       at com.android.ddmlib.DeviceMonitor.openClient(DeviceMonitor.java:822)  
  13.       at com.android.ddmlib.DeviceMonitor.processIncomingJdwpData(DeviceMonitor.java:781)  
  14.       at com.android.ddmlib.DeviceMonitor.deviceClientMonitorLoop(DeviceMonitor.java:649)  
  15.       at com.android.ddmlib.DeviceMonitor.access$100(DeviceMonitor.java:42)  
  16.       at com.android.ddmlib.DeviceMonitor$3.run(DeviceMonitor.java:577)  


通常是同时打开了两个eclipse,关闭一个即可

问题6
[java] view plaincopyprint?在CODE上查看代码片派生到我的代码片
  1. Failed to install .apk on device '': Unable to open sync connection!  
  2. java.io.IOException: Unable to open sync connection!  
  3. Launch canceled!  

问题7
[java] view plaincopyprint?在CODE上查看代码片派生到我的代码片
  1. ADB rejected shell command (rm /data/local/.apk): closed  
  2. Error during Sync: Unable to open sync connection!  
  3. Error during Sync: Unable to open sync connection!  
  4. Adb connection Error:远程主机强迫关闭了一个现有的连接。  
  5. Connection attempts: 1  
  6. Connection attempts: 2  
  7. Connection attempts: 3  


问题8
[plain] view plaincopyprint?在CODE上查看代码片派生到我的代码片
  1. Failed to install .apk on device  : Too many open files  
  2. com.android.ddmlib.SyncException: Too many open files  
  3. Launch failed on device:   



问题9
[java] view plaincopyprint?在CODE上查看代码片派生到我的代码片
  1. Failed to install .apk on device '': closed  
  2. com.android.ddmlib.InstallException: closed  
  3. Launch failed on device:  


问题10
[java] view plaincopyprint?在CODE上查看代码片派生到我的代码片
  1. Installation error: INSTALL_FAILED_INSUFFICIENT_STORAGE  
  2. Please check logcat output for more details.  
  3. Launch failed on device:  

问题11
[java] view plaincopyprint?在CODE上查看代码片派生到我的代码片
  1. Installation error: INSTALL_FAILED_UPDATE_INCOMPATIBLE  
  2. Please check logcat output for more details.  
  3. Launch failed on device:   

使用PC套件删除,然后安装不行,通过adb uninstall 再次删除,安装ok

问题12
[java] view plaincopyprint?在CODE上查看代码片派生到我的代码片
  1. Android Launch!  
  2. Connection with adb was interrupted.  
  3. 0 attempts have been made to reconnect.  
  4. You may want to manually restart adb from the Devices view.  


问题13
[java] view plaincopyprint?在CODE上查看代码片派生到我的代码片
  1. Unexpected error while launching logcat. Try reselecting the device.] closed  
  2. om.android.ddmlib.AdbCommandRejectedException: closed  
  3.      at com.android.ddmlib.AdbHelper.executeRemoteCommand(AdbHelper.java:381)  
  4.      at com.android.ddmlib.Device.executeShellCommand(Device.java:462)  
  5.      at com.android.ddmuilib.logcat.LogCatReceiver$1.run(LogCatReceiver.java:109)  
  6.      at java.lang.Thread.run(Unknown Source)  


问题14
[plain] view plaincopyprint?在CODE上查看代码片派生到我的代码片
  1. adb server is out of date.  killing...  
  2. * daemon started successfully *  
  3. error: device offline  

出现问题的版本
[plain] view plaincopyprint?在CODE上查看代码片派生到我的代码片
  1. D:\>adb version  
  2. Android Debug Bridge version 1.0.29   

问题出在adb的版本太低,更新ADT后问题解决
[plain] view plaincopyprint?在CODE上查看代码片派生到我的代码片
  1. D:\>adb version  
  2. Android Debug Bridge version 1.0.31  
0 0