My main problem with developing in Android is that the emulator seems to continually get disconnected from eclipse. This always happens the 2-3 time I try to upload my .apk from eclipse without rebooting the emulator. Eclipse indicates this with an empty DDMS ->Device section and logcat stays blank - sometimes I'm not sure if the new code made it on the device.
The only fix I have for this is to shut down eclipse, and restart it. With the restarting of Eclipse, on top of the emulator boot time, I can't get any momentum going in my development.
Is there a way to reconnect the emulator to eclipse without having to restart Eclipse or even the Emulator?
Update: There were a couple of answers that helped, particularly "reset adb" or Kill-server -> connect adb. However, sometimes even that is troublesome.
I am going to try Pentium10's suggestion of hooking up my G1 and using it as an emulator, but for now, I have found that if I don't see my logcat going, and the emulator is working (This is my biggest problem, because I am outputting all my debugging messages to log) then I can open up CMD and type adb logcat. This streams the log into the command window. Not nicely color coded, but nice enough for me to find my problems...
In eclipse go to Window->Show View->Other->Android->Devices. When your application is run go to this tab and you will see the emulator. If your emulator becomes unresponsive, in the devices tab you will see a down arrow at the right. Click the arrow and a context menu shows up. Hit the option Reset adb.
Just had to do this and it worked beautifully, but it did require you to reset the emulator - though I didn't wait to see if it reconnected on its own.
Try to call 'Reset adb' menu item from DDMS > Devices tab. It helps me in this case.
At most of the time you don't need to restart the emulator.
AFAIK the only workaround for this is to restart Eclipse (I always use this), or use a real phone.
Try adb kill-server, followed by an adb connect
I've had luck reconnecting to the disconnected emulator by entering an adb-over-tcp command line which you can look up in the docs. I think the address and port to use are the ones in the title bar of the emulator window, if not try the next higher port. Once it's back in adb devices eclipse should use it.
in terminal:
$adb kill-server && adb start-server
Related
I have never had an issue debugging in Android until I switched to my current workspace. It happens in both Eclipse and IntelliJ. Previously I had an issue where the phone would hang at the "Waiting to attach debugger" dialog. Somehow I fixed that so the debugger at least attaches to my app.
Now I can set a breakpoint and have the debugger stop at that point. After about 5-10 seconds it disconnects no matter what I do. I'm able to read a few values of variables in memory before everything disappears. My co-worker is able to debug the same app just fine using Eclipse and we haven't been able to figure out what is wrong or different between our workstations (besides me using IntelliJ). We might have different images for our laptops though.
Any ideas? I've had to use Log statements for now but they are just too slow compared to using an actual debugger. I've tried using different USB cables and that didn't make much of a difference. I've gone through the debugger settings and nothing seemed out of the ordinary. Other Q/A's on SO have mentioned the app silently crashing, but I'm ruling that out due to it debugging fine for my co-worker.
I've been having the same problem running IntelliJ IDEA build IC-133.193. I solved the problem with the following actions:
Quit IntelliJ
From a command line kill the adb server with adb kill-server
From a command start the adb server as superuser with sudo adb start-server
Restart IntelliJ
IntelliJ will start the adb server if it detects that it is not running. The key appears to be starting adb as superuser before starting IntelliJ.
[Update] This doesn't always work. The best solution I've found is to start the app on the device and then attach the debugger to the Android process through the Run menu. I haven't had any disconnections using this method.
I have been fighting for a few days with adb not seeing my device. After trying many other posted solutions, I discovered that the issue was with Chrome also trying to connect its debugger to a web view. If Chrome is connected using chrome://inspect, then adb seems to disconnect. Quitting Chrome resolves the issue. Then I can connect with Android Studio and then restart Chrome and reconnect. Hope this helps someone else.
This fixed it for me
Go to Power Options on your computer
Click 'Change plan setting' on your chosen plan.
Click 'Change advanced power setting' on your chosen plan.
Expand 'USB Settings' .
Expand 'USB selective suspend setting' and change it to disabled.
This issue occurs to me when I try to use a USB 3.0 port. Using a USB 2.0 it does not happen.
This happens to me when the cable connection is sensitive.
Is there a way to bring android emulator from offline to online mode without closing AVD?
I tried adb's 'kill-server', 'start-server' commands but this just seems to re-start adb server (adb.exe process), the emulator is still in offline mode and 'adb devices' still show 'offline' state.
Also can someone explain what exactly 'offline' mode of emulator means.
In my case - Emulator (standalone), daemon process and ADB server - all seem to be running. Why is emulator state still offline?
Updating Question:
I have tried 'adb reset' both from Eclipse & command line that does not solve the problem. Issue seems to be more with Emulator Memory. Per my analysis memory of emulator keeps increasing and after a limit (~470 MB in my Windows) if you try to do a adb reset - it brings the state of emulator to offline and no more adb commands work. (also no network calls seem to be working)
If you just created the emulator, in the emulator settings:
1.just click on "About the emulator" -> "Build Number" about 5-7 times.
2.This will open "developers options", go back and click on it and enable "USB debugging"
to bring it online.
Use these commands from the command prompt it will help u
1.adb kill-server //kill all active server
2.adb start-server //start adb server
3.adb devices //check the list of active server
Sometimes/most of the times the solutions described above works. But if it does not, and you had "Launch from snapshot" enabled, killing the emulator and restarting it WITH LAUNCH FROM SNAPHOT DISABLED, will let you of the hook.
I had this problem many, many times in the last few weeks, and although adb kill-server followed by adb devices works 4 times out of 5, that fifth time the only way to get it working again is by disabling the 'launch from snapshot' option. My guess is that the emulator is somehow in a 'wrong' state, but do not understand why myself.
I have faced this problem many times. Some solutions are:
Solution 1:
the emulator
Select & Right Click on Android Project
Run Configurations
Go to tab Target
Enable option Wipe User Data on Emulator launch parameters
Run Application
Solution 2:
Run Emulator
Keep the Emulator, (no matter same error occurs)
Make Sure the Home Screen of Emulator is appeared
go to Window -> Show Perspective -> DDMS --> In Devices Panel -> on Corner Drop Down Menu
Reset adb
Solution 3:
Reset adb manually or using the command line.
Might be helpful for a new user.
This issue can be solved using the below steps:
Open AVD-Manager in android studio and choose the emulator which you want to run
and do the wipe data and cold boot, take reference from the attached pic:
If the doesn't work, go to emulated device and enable the developer options >
enable USB debugging.
When I try to debug using one of the configurations that I've set up (for example Android233), the emulator never actually launches. I just see a little green icon in my task bar that says "launching Android233," but it never launches. I've let it sit there for hours and it never does anything. I don't know if this is related, but my emulators don't show in device view in the DDMS perspective. I have a physical Android device, which shows up in device view. My question is, what is happenin' and how can I fix it?
Thanks for taking the time to read my question :)
I thought I had the problem figured out, but it stopped working again. Here's more information: When I run my debug configuration, in the lower right corner of my Ecplipse windows it says:
"Launching MyDebugConfig (100%)" and then there's a green icon next to it.
I looked in task manager and the emulator is not in there. I looked in DDMS and my AVD is not listed and there is nothing in the LogCat or Thread or anything else for that matter. I have my debug configuration set to prompt me to pick a device, but it never does that. It just loads my AVD, even if I have my phone connected (which is visible in DDMS). I'm so stumped. I've had this problem since I started using Eclipse and I don't know what to do.
Thanks.
Go to DDMS Perspective =>Click View menu=>reset adb
If Your genymotion virtual device is not seen in android device monitor then just try this.
1. start android studio
2. start Android Device Monitor
3. Lastly start the genymotion virtual device it will appear
The emulator won't show up in the DDMS section until its running.
The emulator won't lunch probably because you misconfigured it, currently the lunch dialog of the emulator doesn't support error messages, however you can get the lunch stack trace while you try to lunch the emulator via Eclipse.
Disconnect your physical device, run your project and select the emulator. you should see an error message on DDMS console.
If you in Windows try run (after starting emulator)
adb.exe kill-server
adb.exe start-server
and wait for restarting your adb
I just started using the ADB Log yesterday (Window -> Output -> ADB Log) and it showed me where my error was coming from as debuggers should. However, when I started it up today it won't show anything other than Error - No devices found then it tries to reconnect in 10 seconds. Eventually it just states that the device is offline.
I have the emulator up and running and replicated the error I had yesterday but still nothing useful from the debugger shows up. I haven't changed anything since yesterday and am not sure why I'm having the issue.
Does anyone know of any possible fixes?
Quick tip (this may or may not solve your problem): In your DDMS view, if the device isn't selected (in the left list of devices with their running processes), then nothing will display in logcat.
Also sometimes I have to run the following command when adb starts acting buggy:
adb kill-server
adb start-server (or adb devices)
EDIT: This is for Eclipse - not sure about Netbeans
Also: I have found that some cables do not work with debugging, only charging (these are cheaper cables). I had something like the same issue, once I used a better cable it started working.
I'm now facing a problem with Eclipse on Ubuntu. My device is connected, list by "adb devices" command and I can see the list of processes running in the Devices view. But all controls in the Emulator Control are disabled.
Does anyone know what may be the reason for this?
Thanks
First, make sure that the device is selected in the Devices view. You cannot use Emulator Control unless the device or emulator is selected.
If that does not help, close Eclipse, and try running DDMS outside of Eclipse -- there's a ddms shell script in the tools/ directory of wherever you installed the Android SDK.
If that does not help, run adb kill-server, followed by adb start-server, where adb should be in your platform-tools/ directory of your SDK installation. Then, try DDMS again.
If that does not help, reboot, then try DDMS again.
i found this with try and error .. it worked ..
As the new emulator got a side bar with icons .. the last icon down this list (the hamburger icon) click it .. then u will have the location latitude and longitude available to send to device
After unplugging USB connection from real device Emulator Control start work properly with Virtual devices
You can't send locations to actual devices, only emulators. You can mock your devices location however, in your code.
http://developer.android.com/training/location/location-testing.html