user1020014
user1020014

Reputation: 265

Eclipse keeps starting new emulators

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

Upvotes: 23

Views: 9906

Answers (6)

cougar11286
cougar11286

Reputation: 1

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.

Upvotes: 0

Gauraw
Gauraw

Reputation: 404

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.

Upvotes: 0

DjP
DjP

Reputation: 4577

best way to just kill the current running server

adb kill-server

Upvotes: 1

Manesh Appukuttan
Manesh Appukuttan

Reputation: 347

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.

Upvotes: 0

Dororo
Dororo

Reputation: 3440

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.

Upvotes: 5

Kevin Galligan
Kevin Galligan

Reputation: 17302

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).

Upvotes: 31

Related Questions