I'm starting android development from just three days, I have downloaded the SDK and install the platform and define the emulator, but it takes a lot of time to boot every time I run the application
Is there a way to run the emulator once and then run the application and to be updated on the emulator without closing it and re-opening it again
I'm using eclipse classic please any one try to help
Yes, just hit "Run" again, it will be reinstalled automatically if you changed code, otherwise you will see a message like "brought to front".
I recommend to not stop the emulator as long as you don't have to.
You don't need to close your emulator every time. Assuming you are using eclipse--> Right click on project-->Run-->Android application, if any changes, those will be deployed. Otherwise same screen will showup.
Yes. I usually just leave it open and launching the program from Eclipse updates the program in the emulator and launches it.
One weird thing is that the first time I launch it I get an error from Eclipse telling me that it has not been able to connect to the emulator, and the next time I launch the application a new emulator is launched. Usually I just close the first emulator, launch it again and then it works as it should.
Related
I just wonder how do I stop or exit Android emulator if I want to modify the source code and run again?
Do I just click on the emulator the "Power" button?
Restarting the emulator is the equivalent of rebooting a phone everytime you test something.
It takes a lot of time and it's completely unnecessary (unless you're testing something that happens during reboot). Just re-run the code, Eclipse and adb will do the rest. Keep the window of the emulator open all the time, it will just re-install the apk onto it.
Unlike iPhone/iPad Emulator, Android Emulator doesn't remain active in AVD.
Once (for first time only) I run the app on emulator, it works, quiet slow though.
I go back in the code, do some changes and try to test new code on emulator, but for second time, the existing emulator doesn't show up in the AVD Manager list. Yes, after last debug, I came back to home screen, retried to Run, AVD Manager pop up and shows me only my android phone connected but not the emulator.
I tried this(Eclipse not running Android app on emulator a second time) answer already but it doesn't solve my problem.
Do I need to restart the emulator everytime I make an edit to the app I'm working on? Also I have created a databse in one of my apps and open this app in the same emulator each time. Each time I open the app does it create a new database on the emulator or when I close it and re open it is the database still there with all the stored values?
You will not need to restart the emulator each time, you can just push the new version of the APK to the device manually, or Eclipse will handle this automatically.
It will reuse the already created database unless you uninstall the application from the emulator or clear the application's data.
As Eclipse installs the application for you when you hit the "Play" Button, I usually use the command "adb uninstall my.app.name" to remove the application as it is faster than browse to the data folder and erase the database.
You don't need to restart the emulator every time you modify your code, just keep it open. In fact, even if you are using Eclipse, you don't need to start the emulator from inside the IDE, you can run it separately and Eclipse will find the running emulator. This is very useful when you need to run a custom kernel or a custom memory partition.
The emulator is, for all intensive purposes, like your phone.
So stopping and starting the emulator is like turning a phone off/on. The data in a database should remain persistent.
Also, don't keep re-starting the emulator. Way too slow.. By "Running" the application each time you make a change, will tell Eclipse to send a new APK file to the emulator. You can see the build and deployment in the Console occurring when you run the application. The emulator session continues to run, but a new APK file is deployed and launched.
If you encounter strange startup problems, try "Cleaning" the project as well.
It is not mandatory to restart emulator every time. It will use already existing database unless you install the app
I am trying to write an android application and my workflow is as follows:
Write some code
Click run as Android Application
Eclipse then starts the android emulator
Install the app on the emulator
Run it
It seems to me that there is no need for it to start an android emulator(3) each time and to kill it. It'd be nice if there was a way an android emulator always running and eclipse just installs/uninstalls the app instead of making me wait every time.
Does anyone know a way of doing this?
Yeah, it just does that way - leave emulator on, and "run" in Eclipse will update the app and run it. This is how it works for me.
Just don't kill the emulator!
When developing for Android do you typically need to stop the emulator and restart it every time you make a change to your Java code or is there a faster way? The emulator takes about 1.5 minutes to start for me, is this normal?
Yes. Starting an emulator is slow, but you don't need to reboot it usually when you make changes. You can just target the already running emulator, at least in eclipse.
It is worthwhile to use the "Snapshot" functionality of the emulator. It can be enabled when you create (or you can edit) your AVD image.
This will take a "Snapshot" of the emulator image when you stop running. Then it restarts the emulator to that exact same place.
When using this feature, the emulator start-up time is sped up by a factor if 10+ (I see a 10 sec start-up compared to 90 sec to bring it up from scratch).
It is important to note, that this will maintain "state" of your emulator between runs. This can be useful if you are trying to test a particular scenario. It can be bad if you run your emulator out of memory, then "snapshot" that (at which point, you can always take a fresh snapshot, and start again).
The emulator take some time to start, depending on the running machine and the amount of programs you are running on the host.
If you installed the eclipse plugin, you don't need to restart the emulator each time: simply hit run in eclipse, and the plugin will take care of making the .apk package, put it in the device and start the activity (if any).
There is really no need to restart the emulator. You can keep it running all day (or longer). If you do not use eclipse: adb install -r will do the job (-r to replace the existing package) and restart your app.
Mine takes a minute + to start. I tried adding -no-boot-anim to speed it up, but the few tests I did it did not speed it up.
There is no need to close Android Emulator when you changes in code just simple do one thing
Leave AVD running and you will have to press F11 (or run your app), make sure you are at home screen of AVD.
To start the emulator in Eclipse, go to Window -> Android SDK and AVD Manager, then select the virtual device you want and hit start. This way it will stay on and not shutdown when your app terminates.
I have noticed that sometimes I have to shut down the emulator and restart it. It appears to hang at "waiting for home to launch". This only hangs the first time. Once it successfully launches I can reinstall repeatedly with no issues.
Yes, as everyone said you don't have to restart the emulator. I'm not sure if it's my computer (obviously to some degree it would be) but even when I simply make a one line change and relaunch, eclipse/AVD take roughly 2-3 minutes to fully load my new package to the emulator. Sucks having to wait this long between changes, but it also makes you want to write better code the first time rather than being sloppy and just test the results.