问题
Am trying to view my database tables using Android Device Monitor and It showing me Errors for reasons which i am not really sure of. And i don't have another instance of DDMS running.
Instead of showing my DDMS, Its showing me this errors
[2015-09-10 17:39:53 - ddms] Could not open Selected VM debug port (8700). Make sure you do not have another instance of DDMS or of the eclipse plugin running. If it's being used by something else, choose a new port number in the preferences.
[2015-09-10 17:39:53 - ddms] Can't bind to local 8600 for debugger
[2015-09-10 17:39:53 - ddmlib] Broken pipe
java.io.IOException: Broken pipe
at sun.nio.ch.FileDispatcherImpl.write0(Native Method)
at sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:47)
at sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:93)
at sun.nio.ch.IOUtil.write(IOUtil.java:65)
at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:487)
at com.android.ddmlib.JdwpPacket.writeAndConsume(JdwpPacket.java:213)
at com.android.ddmlib.Client.sendAndConsume(Client.java:677)
at com.android.ddmlib.HandleHeap.sendREAQ(HandleHeap.java:349)
at com.android.ddmlib.Client.requestAllocationStatus(Client.java:523)
at com.android.ddmlib.DeviceMonitor.createClient(DeviceMonitor.java:847)
at com.android.ddmlib.DeviceMonitor.openClient(DeviceMonitor.java:815)
at com.android.ddmlib.DeviceMonitor.processIncomingJdwpData(DeviceMonitor.java:775)
at com.android.ddmlib.DeviceMonitor.deviceClientMonitorLoop(DeviceMonitor.java:664)
at com.android.ddmlib.DeviceMonitor.access$100(DeviceMonitor.java:46)
at com.android.ddmlib.DeviceMonitor$3.run(DeviceMonitor.java:592)
Please, any one knows a solution to this ???
回答1:
Try killing the adb server and restarting the adb server from terminal.
adb kill-server
adb start-server
Also on your mobile device, toggle the usb debugging. Both of these combine worked for me when I had this issue.
Also you may want to consider using Stetho by Facebook, you can view your database as well as run queries with Stetho. Stetho also lets you watch network calls, view your view hierarchy and more.
回答2:
On Mac, Open terminal and type:
sudo nano /etc/hosts
Add following line to your hosts file
127.0.0.1 localhost
Save and exit.
In Android Studio, you can start debugging again. I got stuck with the same problem and I ended up doing above, problem solved.
Hope this helps :) .
回答3:
A similar question helped me solve this issue here:
Android Studio and android device monitor
By opening DDMS from within Android Studio, I am able to bind and monitor my android devices with no more broken pipes or port conflicts.
Simply follow these steps to open DDMS from within android studio: Select Tools > Android > Android Device Monitor
I can only assume AS runs a DDMS instance silently, since when AS is closed, manually opening DDMS has no issues. Only when AS is running do I get this when running DDMS from the CLI
回答4:
For osx users
Yes you need to restart adb. Simply restart android studio should do the trick. If it's still not working, force killing the thread on port 8600 by this
[sudo] lsof -i :8600
Then for the PID
kill -9 <PID>
回答5:
What worked for me was restarting the computer. I think this happened after force-quitting Android Studio.
回答6:
in case of converting your webapp into android app.
if u give your url like this : localhost:xxxx/abc/xx then it create the problem because the port of your localhost and port of your emulator is different. you are using emulator it work like a separate device in your computer.
SO FRIENDS USE IP ADDRESS INSTEAD OF LOCALHOST AND IT WILL WORK ...101% WORK I AM SURE
来源:https://stackoverflow.com/questions/32507534/ddms-cant-bind-to-local-8600-for-debugger-on-android-studio