Sometime just after I launched a new emulator, for very first time I was trying to upload my apk, however I got "emulator: ERROR: the user data image is used by another emulator. aborting".
I launched a new emulator, and left it alone, several minutes later, DDMS showed "device offline".
I had to restart a new one, you know, minutes wasted.
It's really bothering that I keep getting this error and slowed down debugging.
How do I fix it?
If the emulator is still alive, you can tell adb to connect to it via tcp (which is I believe what it does anyway, only it normally uses an 'emulator' class of name and would now get a ip:port one)
It's been a while since I've had to do that, but I think that if you were using emulator-5554 you would connect to your development machine's loopback one port higher, ie:
adb connect localhost:5555
If it works adb devices will show it an eclipse should see it as a deployment option
The 'in use' problem sounds like a stale lockfile perhaps left behind in a crash
I have another solution. try this
Run configurations > Target > Wipe user data > Run
In my case it happens when I have another process listening on emulator port.
e.g. if I see:
emulator-5554 offline
it means that something is using port 5554
Manually delete these following folders:
C:\Users\%UserName%.android\avd\AVD2.1.avd\cache.img.lock
C:\Users\%UserName%.android\avd\AVD2.1.avd\userdata-qemu.img.lock
this always works for me. :3
On Arch Linux x64, I had this similar problem which led me to this question. Using Eclipse, the emulator-5554 window would freeze, and Eclipse prompted me to start a new one. In the following dialog, emulator-5554 was reported to be offline, with an unknown target. If I started a new instance, it would be emulator-5556. This problem persisted through Eclipse restarts and log-off-on cycles too! Further, killx would close the window, but the process was still running.
So, find the emulator64-arm process id (not emulator-arm!):
ps ax | grep "emulator64-arm"
...and then just kill -9 it:
sudo kill -9 6728
...where 6728 was its PID. This completely disconnects the emulator so Eclipse can try to run it again.
Open android debug monitor window by
typing "monitor" command in cmd,
then select device in the monitor window,
click on down arrow as shown in the figure then just click on reset tab thats all you will get internet connection.
It was some strange
I had that problem, automatically stopped the emulator localhost:5554 after to launch the application.
I didn't know why it happens but intil today I did something different at I could launch as normality.
What I did as different was to change the prespective of Eclipse ADT. I was executing the application from Debug and now I executed from Java Prespective, it worked, I don't know the reason, I had to share it, sound some .. this answer but I resolved doing that without deleting and creating again my android virtual device.
Related
I can see there are 4877 messages in total in my logcat but when I select the "All messages" filter, nothing is there.
I have tried the following:
adb kill-server
adb start-server
Of course, I went to DDMS and select my 1 and only device (a real handset, not an emulator) but it didn't solve the problem.
I can certainly view logcat messages using adb logcat command but it's very difficult to see compared to logcat in ADT.
Restarting ADT does solve this problem but it's happening way too often and you all know restarting ADT takes time.
Note that the "All messages (no filters)" filter is only an example here. The same issue happens to the custom filters I've created as well.
It doesn't always update that value when you clear it or if they get pushed out of the buffer. As long as you don't tamper with ADB or manually clear it it the 'No Filter' option should stay full though.
Does anybody meet this situation before? I force stop an app in the setting dialog in a Android device.
But when I use ps command via adb it is still displayed on the screen. But this process can't be get by the activityManager.getRunningAppProcesses(). This process even exists after I uninstall this app, It happened randomly.
Because I opened a port in my app using ServerSocket, the port can't be released after I stop my app.
The next time I tried to open my app, it failed to using this port again.
I am using a ASUS EeePad and this problem seems only happened on that device.
By the way, the process can't be get by any 3rd party tools such as process manager.
But it really exists with a pid when I use ps via adb shell to list all processes.
Since there is no code .. here are some hints :
1-do you close your connection ??? that will be the main reason to hold the port busy.
2- deal with socket more safely when your app going to pause , stop, or being destroyed .. you can override onpause,onstop, or ondesotry ..and free the port before closing the app.
3- make connection in a separated thread and implement a timer to check if you really need the port or not ( I mean if your app is alive or not ) and based on that kill/leave the thread (connection)
4- in worst cases .. if you have control over the other side of connection ( server, device .. ) try to make your solution more flexible like making range of ports to firstly check then use if they are available.
good luck
The app works fine in the emulator, but after installation on a phone, it crashes every time on launch, and logcat shows no errors.
What am I supposed to do when something like this happens?
My Suggestion for easier resolution of your problem :
Run the app from the eclipse in debug mode on the Phone . It will make it run on debug mode. You will most likely get more debug output.
Turn on ADB in the phone.
Connect the Phone to the PC
Run as "Debug Configuration" from eclipse.
It should run from your phone and Eclipse will ask for your choice for first time before running that.
Turning the Debug Mode on ( Note : This isn't the 'ADB connection' we are referring to ) , It will enable further logging of the application and doesn't do garbage collection normally.
( You will notice a 'Waiting for debug connection' dialogue , if the applications are forced to work in debug mode ).
For e.g :It makes the Async threads keep running and doesn't stop running. Crude and irrelevant for your case . But just as an example.
So , Since the Applications in the phone are forced to run in debug mode , it will get the logcat with detailed errors down to the specific threads.
However, the debug mode is better used when it's used in conjunction with "Debug As" run configuration from Eclipse. And keep in mind that it will automatically turn on that debug application mode ( And there by the dialog box also) , the logcat will show you more details and plus it will break-point at the errors which occur ,in their sequence of occurence.
Regarding what Ares told,
When you want to do the debugging of a process directly,
You can go to the DDMS panel in Eclipse,
On the right side tab menu Devices ,
Select the process you want to debug . and click on the green symbol ( Says, Start Debugging process )
It will automatically go to the source when it breaks if you have the source code in that eclipse work-space.
Additional hint:
On huawei phones, logcat doesn't show debug messages and excpetions, if the phone is in default system settings.
In order to enable logcat full logs on Huawei phones, you must do the following:
Open the factory settings menu by dialing *#*#2846579#*#*
Navigate to Project Menu / Background Setting / Log setting
On older phones: define the log availability (log switch) and level (log level setting).
On never phones: tick AP Log (which seems to enable app logging in general) and CP Log (seems to enable debug logging)
Close the menu with your backbutton (no restart needed)
Source: https://stackoverflow.com/a/18395092/1075072
Install a tool like AndroidSystemInfo that can show you the logfile on the phone - even when you are away from the host computer.
It is pretty unusual that Android leaves no trace whatsoever.
Does your app perhaps require features that the phone does not have (e.g. a camera or gps or nfc)?
In Eclipse you should go to DDMS, then click on device's name or android.os in Devices panel. And turn your device in debug mode.
Put your own logs to track what block of code cause crashe, or just debug it.
You can reset adb (In Devices -> View menu -> Reset adb)
Click on the selected online device/emulator to show the logcat
Disconnect the cable and again connect it. (Or restart the emulator)
Restart Eclipse
I restarted my emulator and cleaned my build. This got rid of both the non-logging and the spurious crash I was having
Please guide me about this error
2011-05-02 18:37:20 - SimpleOptionMenu] The connection to adb is down, and a severe error has occured.
[2011-05-02 18:37:20 - SimpleOptionMenu] You must restart adb and Eclipse.
[2011-05-02 18:37:20 - SimpleOptionMenu] Please ensure that adb is correctly located at 'F:\android-sdk-windows\platform-tools\adb.exe' and can be executed.
It was working fine and now i am getting this error . I have restarted eclipse but nothing happed . Thanks
When I faced with this problem, resetting adb is usually the solution.
If this not solves, unplugging-replugging the device works. I never have had to restart Eclipse.
By the way, Reset adb option can be found in DDMS(Dalvik Debug Monitor Server)'s Devices tab.
I have had this error from time to time too, and restarting Eclipse has fixed it. My best guess is that you had the misfortune of getting the error twice in a row. Try restarting again and see if it goes away.
Writing this post has had the unfortunate effect of making me realize that the Android SDK bears a striking resemblance to Windows.
I do not know the reason but restating up my system worked for me :) !!!
I just posted the response below here:
adb kill-server not responding?.
I am duplicating it here too as Google considers this thread as one of
the top hits.
If zombie adb process is not the issue i.e. there's no adb.exe in the task-manager list, the problem is usually adb ports e.g. 5555, 5554, 5037 etc., being taken by other applications.
Solutions:
On all Windows: find the process taking one of those ports using netstat -bn and kill it from task-manager Ctrl+Shift+Esc is the shortcut.
On Windows 7 and 8: there's this new tool called Resource Monitor. It'll also allow you to find out the blocked port and blocking process under the network tab.
On Linux: the similar is done with netstat -pn. Feel free to use your grep foo as needed and kill the blocking process with kill or pkill.
Change Default ADB Port: Apparently default ADB port can be changed as described here by setting up an environmental variable before launching ADB. Give it shot. It'll allow more flexibility if you don't want to kill the blocking processes.
I've just started going through the tutorials but seem to be having some trouble with the following portion:
"Run > Debug History > Hello, Android from the menu to enter debug mode. Your app will restart in the emulator, but this time it will suspend when it reaches the breakpoint you set. You can then step through the code in Eclipse's Debug Perspective, just as you would for any other application."
when I follow these instructions I see a list of warnings like this...
[2010-11-24 15:39:43 - ddms]Can't bind to local 8617 for debugger
and finally this...
[2010-11-24 16:08:25 - HelloAndroidWeb] Launch error: Failed to connect to remote VM. Connection refused.
I've never used a debugger before but from reading the tutorail I expect a new window to open (the Debug Perspective), but this is not the case. Have I dont something wrong in during installation/setup.
Thanks
Is the application running on the emulator or an attached device? If on a device, USB Debugging mode needs to be enable through the setup menu. If in the emulator, you may have to restart it in order to reattach the debugger (ADB).
In the 'Devices' panel do you see the list of active processes running? Can you select your application and click on the 'Debug select process' icon?
Is debbing set to true in your manifest?