23

I'm busy learning how to build apps for Android, and I come across a very awkward problem.

When I run my application (with the green circle with the play-icon in it), it starts an Android emulator (like it should), but the application doesn't start once the emulator is booted. When I click the run-button again, it tries to start a second android-emulator. In the console-tab it gives the following messages:

[2011-11-07 20:57:15 - ScrollView Demo] Android Launch!
[2011-11-07 20:57:15 - ScrollView Demo] adb is running normally.
[2011-11-07 20:57:15 - ScrollView Demo] Performing testapp.scrollviewdemo.MainActivity activity launch
[2011-11-07 20:57:15 - ScrollView Demo] Automatic Target Mode: launching new emulator with compatible AVD 'Android_emulator'
[2011-11-07 20:57:15 - ScrollView Demo] Launching a new emulator with Virtual Device 'Android_emulator'
[2011-11-07 20:57:18 - Emulator] WARNING: Data partition already in use. Changes will not persist!
[2011-11-07 20:57:18 - Emulator] WARNING: SD Card image already in use: C:\Users\Roy\.android\avd\Android_emulator.avd/sdcard.img
[2011-11-07 20:57:18 - Emulator] WARNING: Cache partition already in use. Changes will not persist!

It's like Eclipse doesn't recognize the emulators it starts... Weird thing is, sometimes it does recognize it, but most of the times it doesn't.

If it makes any difference: I'm running Eclipse IDE for Java Developers (Indigo Service Release 1) with ADT 15.0.0 on Win7 Home Premium 64bit

user1020014
  • 265
  • 3
  • 6
  • 2
    Eclipse is buggy. I recommend getting an actual android device to debug on. It is way more responsive and much faster to debug than with the emulator. – onit Nov 07 '11 at 20:07
  • 1
    It takes a long time to deploy android apps, and there's virtually no indication that its doing anything. Are you sure you're waiting long enough? – William Melani Nov 07 '11 at 20:08
  • 1
    Thanks for the fast comments! @ onit: I have an actual anroid device, but since that is my daily phone, I don't want to use it for testing all kinds of stuff on it. That is why I'd like to use the emulator. I know it's way slower, but as long as it functions, I'm okay with that. @ willmel: I've once let it sit there for about 15 minutes, so I fairly sure that is not the problem. – user1020014 Nov 07 '11 at 20:21
  • I use the emulator because as a starving student I can't afford one yet. – Gabriel Fair Mar 01 '12 at 19:36

6 Answers6

31

If the emulator has started, that may mean adb is acting up. Not sure on windows, but on mac/linux I do the following:

adb kill-server
sudo adb devices

You could try that (get rid of the 'sudo' business).

Kevin Galligan
  • 16,159
  • 5
  • 42
  • 62
  • This did the trick! Thanks for your answer! (since I'm on windows, the sudo doesn't apply to my situation as you explained). For others that have this problem: You have to kill the abd-proces through the taskmanager, and start it with the cmd-window. You leave eclipse and the emulator open while doing this. Once adb is started again, the virtual device will appear in the DDMS-screen of Eclipse. – user1020014 Nov 08 '11 at 19:11
  • I first had [this problem](http://stackoverflow.com/questions/4072706/the-connection-to-adb-is-down-and-a-sever-error-has-occured) and then this one, but luckily this answer solved it. :) – ZeroOne Aug 21 '13 at 19:47
5

I don't think you're waiting long enough. There's 3 stages to go through

  • Wait until the android logo disappears on startup (unless you've disabled boot animations)
  • Wait for the locked screen to come up.
  • Wait for the app to be actually installed onto the device (you'll get a message saying 'Installing nameOfApp on Emulator device #whatever')

This whole process will take anywhere from 3 - 15 minutes. To speed things up, make sure you leave the emulator ON then you just need to do step 3.

If you try to click Run again before this is all done, it will incorrectly assume no emulator is up and start up a new one.

You can also make sure your emulator is ok by selecting Window -> Android SDK and AVD Manager and selecting Virtual Devices. You can even start a device up first (stages 1 and 2) without actually installing your app. You can also check the status of the device using DDMS (and make sure that it isn't actually installing your app and then silently crashing) by selecting DDMS at the top-right of Eclipse or Window -> Open Perspective -> Other -> DDMS

Hope this helps.

Dororo
  • 3,420
  • 2
  • 30
  • 46
  • 1
    Thanks for the reply! To test this answer I started the virtual device with the Android AVD. I let it start-up to the lock-screen, unlocked the screen and let it sit right there for a little over 30 minutes. I checked the DDMS-screen, and it was empty. When I pressed the "Run"-button it began to start a second instance of the emulator. So no luck with this answer. The other answer (about the abd service) did solve my problem, but like I said: thanks for taking the time to write an answer in suh good detail! – user1020014 Nov 08 '11 at 19:10
1

best way to just kill the current running server

adb kill-server
Mark Parnell
  • 9,175
  • 9
  • 31
  • 36
DjP
  • 4,537
  • 2
  • 25
  • 34
0

After starting the emulator, check the emulator name has been reflected in Eclipse->DDMS->Devices. If it is mentioned as "Online", you can just run the application and it wont launch new emulator. If it is mentioned as "Offline", go to "View Menu" option(a small down arrow button in Devices window) and reset the adb. This will restart adb and will make emulator Online.

0

Go to Command prompt and set the path where the adb is stored and give the following command: First kill the adb by giving the command adb kill-server and then start the adb by giving the command adb start-server(for windows) Otherwise there is another option Go to DDMS and restart the adb.

Sahil
  • 75
  • 5
Gauraw
  • 304
  • 2
  • 5
  • 13
0

I do not believe what you are witnessing is a bug at all.

You probably do not need to restart the adb.

What is happening is this:

If the current emulator you are running does not fit the minimum SDK of project you trying to run. The Android SDK manager will run an emulator that does fit the minimum sdk requirement.