Reputation: 12323
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?
Upvotes: 52
Views: 57557
Reputation: 6988
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:
And run:
More info in this link.
Upvotes: 3
Reputation: 2613
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.
Upvotes: 57
Reputation: 6357
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.
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:
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
Upvotes: 21
Reputation: 4869
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
Upvotes: 1