user1930111
user1930111

Reputation: 43

Can you relaunch a program in Android Emulator without restarting the emulator?

The android emulator takes a long time to launch and I'm wondering if there is a faster way. I am using eclipse indigo.

I wrote a simple "touch me" application where it says 'touched me X times' where X increments for each click.

Suppose I change the code from touchCount++ to touchCount+=2 in my Java source code. Is there a way to make the android emulator quickly incorporate this change into the code without restarting the emulator altogether?

Upvotes: 0

Views: 700

Answers (4)

codeMagic
codeMagic

Reputation: 44571

No, you need to run the program again so it can rebuild it. Besides, you wouldn't really want to do this. While it may seem like it would make it easier, a change in one part of your program could effect other parts that you didn't realize then you would have to go back and figure out which change you made that created the new problem.

Also, just a tip, I would suggest getting a real device to test on. It is much more efficient and I would say accurate. Depending on what you are doing, invest in a cheap Android device that you can test on for now or use your phone if that's an option.

Edit

In case this was the issue, I certainly wasn't suggesting that the emulator would need to be restarted each time. This is why I said "you need to run the program again".

Upvotes: 0

Kirk
Kirk

Reputation: 16245

I've had troubles where re-running the application would launch a new instance instead of re-using an existing, open emulator. The way I've solved this is to have it ask me every time which prevents new ones from launching.

To allow Eclipse to prompt you:

  • Open the Run menu > Run configurations
  • Within the new window, double click Android Application
    • This creates a new run configuration
  • Open the Target tab
  • Select Always prompt to pick device
  • Click Apply
  • Click Close

Launch a new emulator the first time and leave it open.

Now the next time you run your application, it will ask you to start a new emulator or use one that is already open. Choose the one that is already open.

This also has the added benefit of allowing you to choose different AVD versions to test your app if you have multiple versions of emulators with different versions of Android.

Also you are able to plug in your phone to your computer via USB and it will appear in this list as well.

I've found this to speed up testing dramatically for me.

Upvotes: 0

m.drz
m.drz

Reputation: 81

You can keep the emulator running in the background. just press the back button to exit out of the program that was running on it to get back to the emulators home screen. Do not close the emulator. Then when you rebuild your app with the new code it should start up the newer version on the emulator.

Upvotes: 0

Mr.Me
Mr.Me

Reputation: 9276

You don't have to restart the emulator every-time you want to update your code. that would be a painful process and a true time killer.

just use debug button. to reupload your apk to the emulator.

take a look here for more about android emulator usage :Emulator usage

Upvotes: 1

Related Questions