Android---真機調試時不能識別手機的解決方案


我自己遇到的問題是VS2013和VS2015中xamarin無法識別到真機,現象就是插上手機開啟調試模式,豌豆莢都可以連接上手機,就是VS上沒出現手機。
但是低版本的手機貌似又行,4.0.3的。
於是排除了各種問題,比如手機開發這模式,數據線,ADB驅動,ANDROID SDK升級,都不行,
最后隨意地點了下Restart Adb Server:
發現居然可以識別到真機了,我只能說比較神奇。。。
 
以下都是ADB連接問題,可以通過嘗試如下步驟,由簡單度排序
1. 插拔下USB連接線
2. 關閉USB模式再打開
3. 執行以下命令
  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 
 
  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
  1. ADB server didn't ACK  
  2. * failed to start daemon *   
問題3
  1. Adb failed to restart! Make sure the plugin is properly configured   
問題4
  1. ** Adb connection Error:遠程主機強迫關閉了一個現有的連接   
問題5
  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
  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
  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
 
  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
  1. Failed to install .apk on device '': closed  
  2. com.android.ddmlib.InstallException: closed  
  3. Launch failed on device:  
問題10
 
  1. Installation error: INSTALL_FAILED_INSUFFICIENT_STORAGE  
  2. Please check logcat output for more details.  
  3. Launch failed on device:  
     
問題11
 
  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
  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
  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
  1. adb server is out of date.  killing...  
  2. * daemon started successfully *  
  3. error: device offline  
     
出現問題的版本
 
  1. D:\>adb version  
  2. Android Debug Bridge version 1.0.29   
     
問題出在adb的版本太低,更新ADT后問題解決
 
  1. D:\>adb version  
  2. Android Debug Bridge version 1.0.31  


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM