There are lots of times Eclipse can't connect to emulator that I turned on from AVD Manager, and just starts a new emulator by itself,( two emulators are the same ):((. How can I make eclipse find the emulator ?
some times restarting adb solves your problem
adb kill-server
adb start-server
for working easier in command line in windows, add the path of adb.exe to that Windows' path. For example add ";C:\Program Files\Android\android-sdk\platform-tools" to System Properties-> Advanced-> Environment Variables-> System Variables-> Path
One of the reasons of problems in device connection is a long USB cable or a two-piece cables like keyboard USB. try to connect your device to PC directly by a short cable.
I guess that you might suffer from the issue that the manually started emulator got disconnected somehow, shown with a message like
Error: emulator-5554 disconnected
in the Eclipse console view. There are several related questions and answers on stackoverflow like Why do I get a emulator-5554 disconnected message,
but for me none of those answers helped.
Whenever I see the error message for disconnection occur, I just shutdown that emulator and start it again. Normally that already "fixes" the problem, it just works on the next attempt (for me).
I was just experiencing this issue also. I agree with breceivemail, the ADB reconnected to the emulated device after reset, but there is a shortcut using Eclipse:
In the DDMS view => Devices window => View Menu (the down triangle in the header) => reset adb
You can choose the target device manually by changing the run configurations.
Run -> Run configurations -> choose your App -> Target tab -> select "Always promt to pick device"
If your device isn't available you will at least don't start a new Emulator.
If the emulator is still active, you can use adb to connect to it via tcp. In this way you can connect a disconnected emulator to your development system's loopback one port higher, just like if you are using emulator-5554, you can connect to it by using a higher port.
adb connect localhost:5555
There was been an issue with this technique, where the emulator control becomes inactive, and the developer cannot send GPS coordinates or SMSs or calls to emulator.
There is a one click method to do this
Open notepad
Type the below code
#echo off
adb connect localhost:5555
Save the file as your_file_name.BAT
Copy the file to Android SDK/platform_tools
Create a shortcut, give it a custom icon, use it anywhere you like
Open the DDMS view from Eclipse, and simply click on the emulator name you want connect to in 'Emulator' tab.
Related
I am starting up an android virtual device, but I am getting:
Starting emulator for AVD 'avd.1'
pulseaudio: pa_context_connect() failed
pulseaudio: Reason: Connection refused
pulseaudio: Failed to initialize PA contextaudio: Could not init `pa' audio driver
emulator: Listening for console connections on port: 5558
emulator: Serial number of this emulator (for ADB): emulator-5558
The emulator is coming up but I see no icons on it so I'm wondering if the errors listed above are "showstoppers"? Then when I try adb install bin/my.apk I get the error Can't find service: package. So it seems adb is not communicating with the AVD correctly. However, adb devices does show emulator-5558 listed above. Any advice would be really helpful.
You have essentially answered your own question while asking it. The root of the problem is that the emulator is not setup properly (evidenced by the system UI not loading). When Android can't boot properly, it is likely to fail to start some system services (in this case, the package service).
The solution is to recreate the emulator, possibly with a different system image (in case the one you have been using is corrupt). If you are using an official image, try switching API levels, or switch from a GMS-enabled emulator image to a non-GMS image (or vice-versa).
It also happened to me after closing the emulator while debugging. Yes, not the best idea...
The solution for me was:
Click on Tools > AVD-Manager.
Click on the arrow to bottom on the right of the new window from your (virtual) device.
Click on "Cold Boot Now".
Don't forget to enable usb debug mode and in developer option to consent data file transfer, for me it solved this issue, hope this help
You can also get this fault when delpoying to physical devices.
The solution is to restart the adb server, using:
adb kill-server
img
here is the image. I can't find my app's process, but others I can see. why did this happen? what should do? Thanks.
Some possible solutions:
On your notification bar, expand it and click the connection. Then select connect as Camera (PTP) (not as media device)
Try with another USB cable.
Go to your SDK manager and install Google USB Driver (I see you updated your answer regarding this)
Follow the instructions on OEM USD Drivers
if you get errors like below:
Unable to get view server version from device;
Unable to get view server protocol version from device
Unable to get the focused window from device
Unable to debug device
try to check these points below:
if signed app running on the phone, DDMS can't get the process info;
otherwise, can.
if use Virtual Device, then the DDMS&HierarchyView is useful;
reinstall app from IDE (if app process running stop it from IDE or force stop if through android setting)
if nothing happened try restart ADB
$ adb kill-server
$ adb start-server
I recently switched to connecting to the phone via WiFi. I am able to compile and upload programs through Eclipse. However, I do not receive any logcat ouput. The phone is also shown in the DDMS view and when my program is started it also displays the name and pid. Is it possible to get the logcat trace via wireless or do I have to switch back to using a USB connection?
UPDATE:
Maybe I did not make it clear enough in my initial post. There is no problem with the connection itself. I can dump the logcat by using a terminal with 'adb logcat -d'. What I want is to see the live logcat in Eclipse's logcat viewer. Not sure if it is of any importance, but I am using Eclipse 3.8 in Debian Jessie.
(1) connect phone with usb, then type in command line:
adb tcpip 5555
you can disconnect your phone from usb now
(if the reason for using wifi is that usb does not work on your machine, just do the above on another computer
(2) find out the IP address of your mobile device (somewhere under settings .... phone status)
(3) in command line type:
adb connect [IP of your mobile]
NOTE: all devices need to be connected to same wifi; avoid using public wifis
In your eclipse,
just go to: windows->preferences->Android->logcat and follow the following setup:
1. double-click action: "go to problem (error line)
2. switch to: java
3. both checkboxes are checked
if setup is fine, clean the project and restart eclipse
Restart Your ADB Server
1) open cmd
2) change directory to platform-tools
3)type adb kill-server
4)then adb start-server
I am not sure what exactly happened, but it is working now. I did not do anything that I had not tried earlier. It just started working after several attempts. Might be a faulty Eclipse installation, it did crash earlier today.
I known there is lots of answers about this question, but still my mobile device not connected to eclipse IDE.
The following is what I already did:
1. restart adb or type command in cmd "adb kill-server/adb restart-server", eclipse find nothing in the devices.
2. execute netstat -aon|findstr "5037", finding there is only one process "adb" occupy the port
3. check the phone driver in device management, finding the phone is install correctly.
4. execute "adb devices":
List of devices attach
1f06cbba device
I thought may it's my phone's problem, so i remove it, and create a virtual device avd, the eclipse still don't work.
My Operating System is Windows 7 and Eclipse IDE Kepler.
can any body help me to successful run my first android helloworld?
Thanks a lot!!
additional explanation
debug mode is in phone is ON
adb is in the variable %path%(maybe some should answered)
try the latest adt-bunble in adroid website, it still don't work.
Try turning "developer options" on in your device. (Option you haven't tried).
To access these settings, open the Developer options in the system Settings. On Android 4.2 and higher, the Developer options screen is hidden by default. To make it available, go to Settings > About phone and tap Build number seven times. Return to the previous screen to find Developer options.
Have you added adb in your class path variables? If not , you should append the class path with following paths :
path-to-sdk/android-sdk/platform-tools
path-to-sdk/android-sdk/tools
Try re-installing ADT Plugin. Worked for me last time.
Install your current mobile Adb USB driver and update Google USB driver
Check the MTP/PTP mode for your device:
http://lh3.ggpht.com/-8UMNs7Vg_dY/UVC6_6PnbDI/AAAAAAAAAIg/NjKOvAp9cDs/02-select-camera-ptp-mode_thumb%25255B1%25255D.png%3Fimgmax%3D800
In some devices you can find this under Settings->Storage->Menu Options(three vertical bullet squares).
When you say->the phone debug mode is open, i assume your developer options usb debugging is already enabled
I have been facing this problem for quite sometime now. Running 'adb devices' shows me an additional dummy device although its named as emulator-5554. FYI, I don't have any emulator running as well.
adb devices
List of devices attached:
xxxxxxx device (Actual device)
emulator-5554 device (Dummy thingy shown as device).
How do I clean up this mess?
Same problem for me but I don't see any Bluestacks service in my services list. after
adb devices shows emulators I didn't have, I usually just type the command
adb kill-server
and running the
adb devices
once more shows only the devices that are connected.
I had the same issue. I did this and now everything is ok
click Windows+R
type services.msc
stop BlueStacks Android Service
I have figured out the issue. I had installed Bluestacks for Mac for trying out Android apps on Mac. This was running an emulator with a different name.
Figured it out by taking a screenshot of the emulator and it showed the launch screen of Bluestacks. Uninstalled Bluestacks and all is well now.
the adb server is scanning for emulators on all even local ports from 5555 to 5555+128 (5683). If you have a custom service which use one of these ports... You are stuck with the "adb -d command" requirement
pls check in task manager whether emulator-arm.exe is running. If so, try stopping both adb.exe and emulator-arm.exe
I had the same problem and non of these answers helped. So I figured out that my system didn't shut down properly and that's the reason I have a dummy emulator-5554. The solution was to create a new emulator with a name then launch it? While it's launching kill the server using cmd until when the emulator powers on and you can see its name under Devices in DDMS. After this shut the emulator...emulator-5554 is gone, Now you can start Bluestacks and connect
I was facing the same issue, and that due to BlueStacks too. In case you have Windows and you don't want to remove it, then you can stop its service "BlueStacks Android Service."
To do that click Windows+R, type services.msc then stop "BlueStacks Android Service"
Reference:
http://forum.xda-developers.com/showthread.php?t=2612389
Eclipse emulator NOT BlueStacks:
In the case of the eclipse emulator running in the background and you don't know how to close it, just go to devices tab and choose the dropdown menu on the right, then Reset adb. OR, just reset the adb using adb console.
Just open task manager and end task bluestacks
I also meet the same problem.Here is my answer to solve this problem.
in Windows system.
1.in cmd terminal,usr cmd netstat -aon|findstr "5555"
2.use cmd tasklist|find "PID",the PID para should be a process number which is the result of the first step .
3.changed the Port No. to other ,which should not be "5555"
That's done.
After trying:
adb kill-server
stopping adb.exe in task manager
adb usb
and a few other stuff I can't even remember. . .
I restarted my computer and the dummy-device was gone!