I am perplexed by the behavior of Android debugger using Android Studio. It just cuts out during my debug session, then device not available. I seem to also lose all logcat files when this happens so don't detect a crash. App does not crash either so ... I am trying to debug a WebView and its corresponding WebViewClient but in the middle of my debug session the debugger just dies. Then it says that no device found when I try to rebuild and run as debug session. I have to unplug and plug back in the USB cord. Only then if I am lucky does the device reappear. But usually debug session lasts just a little while and then cuts off.
adb kill-server
adb start-server
Does not help. Device is no longer available. What could be going on here? Debugging debugger is really tough
Here is what console says:
Uploading file to: /data/local/tmp/com.myapp.debug
java.io.IOException: An existing connection was forcibly closed by the remote host
If I then try to debug again I get:
Uploading file to: /data/local/tmp/com.myapp.debug
com.android.ddmlib.AdbCommandRejectedException: device 'b3941da' not found
I have had this happen on two Android devices a Galaxy III, and Note Android 4.03. Not sure whats going on here. I do see power saving mode some times kicks in on one of the devices ... Turned off power mode, but still see this happening quickly right after trying to load app.
When Debugger gets cut off why is my logcat also destroyed? I mean what's the thinking in doing that? I get one entry left everything else whipped out:
01-01 00:00:00.000 0-0/? E/Internal: device offline
To be frank that's kind of frustrating .....
Now I also see:
Connected to the target VM, address: 'localhost:8600', transport: 'socket'
Disconnected from the target VM, address: 'localhost:8600', transport: 'socket'
Related
Suddenly it is not possible to debug my android device. After a few seconds the device disconnects and i get the following message: "Disconnected from the target VM, address: 'localhost:49504', transport: 'socket'
I am using a Zebra Scanner.
I didn't change the code since the last time that i worked on that app.
I deselected all breakpoints.
I tried different activites.
Even by just starting the app in debug mode, it disconnets after a few seconds.
Running the app and attatching the debugger has the same result.
I've been trying to setup ADB remote debugging for Qt.
Scenario:
Remote development server with QT
Local laptop with connected phone
Solution:
I tunnel all the traffic on port 5037 (default adb port) through a Remote Port Forwarding SSH session. Works Fine.
The commands I execute:
# Kill old adb server.
devhost$ adb kill-server
# Activate adb server on client
laptop$ adb start-server
# Start ssh tunnel. Hide/minimize this window not to close it by accident
laptop$ ssh -XC -R 5037:localhost:5037 <your devhost machine>
QT on dev. server detects the mobile, attempts to the deploy.
The app gets deployed. The result FEELS GOOD. ~~With dev server in another country. It's optic fiber all the way from server right to my desk... But not so fast...
When all of the sudden QT shouts about being unable to connect with localhost:5039
5039? What is it needed for? I tried tunelling 5039 but I'm basically in a blind-spot. The error is gone but the app is stuck at waiting for debugger and no further messages from QT no errors.
Nothing. It just hangs indefinitely.
On the mobile there's the standard waiting for debugger msg at the bottom. (Note: the app got deployed by qt and launched).
Ideas?
The only informative message within log is:
W ActivityThread: Application org.qtproject.APPNAME is waiting for the debugger on port 8100...
8100? now what is that? Is that supposed to be taken care of by ADB/QT or what
I can see all the logcat events on dev-server while the app on mobile 'keeps waiting' ..browser entire logcat log. the only sensible message regarding debugging is that the app keeps waiting on and on.
Local debugging of same app through USB works FINE.
The remote server is able to compile deplay and launch the app on mobile phone, however dubugging is an exercise in futility due to the described behaviour.
I have noticed that during debugging attempts, adb on local laptop keeps opening new ports and listening on these. what the heck is going on here?
On the contrary, when debugging over USB, 5037 is the only port used everything works and adb does not go into the new-port-creation frenzy.
I have a real Android device that I am using to debug. In order to attach Android Studio to my application, I ran this on the device:
adb shell am set-debug-app -w my.package.name
This worked fine. However, the problem is that now, whenever I try to open the application on my device, it will wait for the debugger to attach.
Waiting for Debugger
My Application (my.package.name) is waiting for the debugger to attach.
This happens even after I disconnect the device from my computer. Also, I restarted my device and nothing changed.
This is definitely not related to Android Studio, because my device is not connected to Android Studio, so any solution involving restarting Android studio would not work.
After looking at this page, I tried:
adb shell am force-stop my.package.name
This stops the application. But when I reopen it, it still waits for the debugger to connect.
So, any idea how I can remove this debug hook?
You can set/clear the debug app through Developer Options in your device settings.
If you want to do it through adb, it looks like you could do am clear-debug-app to clear it: http://androidxref.com/8.0.0_r4/xref/frameworks/base/services/core/java/com/android/server/am/ActivityManagerShellCommand.java#166
case "set-debug-app":
return runSetDebugApp(pw);
case "clear-debug-app":
return runClearDebugApp(pw);
Im trying to debug a very simple app i wrote from the Udacity course.
when i run the app in debug mode the app launches on the device, Debugger connects as said in line 1, the message
"waiting for debugger" is shown on my phone for a second. But when that message is gone from phone the debugger is automatically disconnected (line 2).
1. Connected to the target VM, address: 'localhost:8604', transport: 'socket'
2. Disconnected from the target VM, address: 'localhost:8604', transport: 'socket'
I read other question people had here with this issue.
tried rebooting AS, my device, killing adb server and closing Bluestacks.
The only way i managed to debug apps is by pressing Attach debugger to android proccess while i manually opened the app from my phone.
Any ideas? i really need debug option to work properly.
EDIT: When i run the app in normal state i get this log:
7-07 19:57:06.253 22333-22390/com.example.android.justjava I/OpenGLRenderer﹕ Initialized EGL, version 1.4
07-07 19:57:06.258 22333-22390/com.example.android.justjava D/OpenGLRenderer﹕ Enabling debug mode 0
Why debug mode is in 0?
This isn't exactly an answer, since I never understood why it happened, but the same thing happened to me and I resolved it by restarting both my computer and my device, and it has not recurred since. Believe it or not I put up with this for almost a week before it occurred to me to restart my device.
Android Studio on my OS X Yosemite very often stops displaying log messages written by my app under development.
If I go to the ADB logs tab I see a plenty of different error messages:
1) Broken pipe:
ddmlib: Broken pipe
java.io.IOException: Broken pipe
2) null
ddms: null
java.lang.NullPointerException
at com.android.ddmlib.Client.read(Client.java:731)
at com.android.ddmlib.MonitorThread.processClientActivity(MonitorThread.java:311)
at com.android.ddmlib.MonitorThread.run(MonitorThread.java:263)
3) Closed connections
DeviceMonitor: Adb rejected connection to client '5022': closed
4) Unauthorized device
PropertyFetcher: AdbCommandRejectedException getting properties for device HT4C9JT00135: device unauthorized. Please check the confirmation dialog on your device.
5) EOF
DeviceMonitor: Adb connection Error:EOF
It would be funny if this wasn't the development environment for Android.
I was able to solve only error number 4 (I had to forget associated devices and authorize again).
I tried combos of answers found here on SO (for example adb kill/start-server), enabling the ADB integration (which was disabled), ....
Besides planning a trip to Lourdes, what else can I check to see why Android Studio refuses to log my messages? It used to work till some days ago: problems started after the upgrade to 1.1.
Update
I uninstalled and reinstalled Android Studio.
The first time I ran my app adb worked fine: I could see the log messages. From the second run, adb started refusing connections again (problem 3).
Is there anyone who was able to solve this incredible mess?
2nd Update
When there are no log messages, if I unplug and plug again the USB cable, the messages magically appears.