Reload Android application in emulator without restarting emulator in Eclipse?

AndroidEclipse

Android Problem Overview


Is there a way to reload an Android application in the emulator without closing the emulator, saving any code changes, and running the emulator again? If I make even a simple change to the layout, it takes about 30 seconds by time I run it in Eclipse and Android "boots", and I can unlock the emulator to run the application. Is there any way to shorten this time when making changes, or is it something I just have to deal with?

Android Solutions


Solution 1 - Android

The Android emulator is hot-deployable. Once you save and click 'run' (assuming no compile errors) it will package and re-deploy to the emulator which will then restart the app to run the new version. The same is true if you have an Android Developer Phone connected via USB.

If you get the message "Warning: Activity not started, its current task has been brought to the front", it helps to quit/move from the front the running app in the emulator by pressing the back button. Seems like Android does not overwrite the running app in this case.

Solution 2 - Android

In Eclipse go to Run -> Run Configuration ...

For the very first time you need to set the following highlighted option because you don't have any emulator already launched. enter image description here

After the first run now you have an emulator already running. Now when you make a change again go to Run -> Run Configuration ...

and Set the following highlighted option: enter image description here

Now the already running emulator will be used every time to relaunch your application and it takes a way less time.

Note: Every time before clicking the Run button press the back button in your emulator once. So, your application is no more running on emulator. Otherwise you might see the following warning:

Warning: Activity not started, its current task has been brought to the front

Solution 3 - Android

You have already been told that you don't need to restart the emulator, but now with Android Studio 2.0 you don't even need to restart your app. It has a new feature called Instant Run that allows you to update your app without having to restart it.

Simply enable it in Preferences:

enter image description here

And run:

enter image description here

More info in this link.

Solution 4 - Android

instead of running from eclipse, use following batch files in project directory to install and uninstall the apk. Those work great and fast.

Install.bat

cd bin
adb install *.apk

Uninstall.bat

adb uninstall this.is.package.name

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionTai SquaredView Question on Stackoverflow
Solution 1 - AndroidKevin WilliamsView Answer on Stackoverflow
Solution 2 - AndroidAdil MalikView Answer on Stackoverflow
Solution 3 - AndroidGustavoView Answer on Stackoverflow
Solution 4 - AndroidVijay CView Answer on Stackoverflow