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
Related
Each time I launch my Android app in IntelliJ IDEA's virtual emulator, it seems to install a new copy of the app. I have 4 copies of the same app in the emulated phone now. :/ Is there a way I can force the emulator to install over the previous installation each time I run it, instead of installing a new copy of the app?
Edit: I've found that selecting 'wipe user data' works in a pinch. I'm hoping there is a more elegant solution though, as wiping clears out everything (including files on the phone, user logins etc) which isn't always what I want.
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.
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.
I seem to get this error message fairly frequently:
INSTALL_FAILED_INSUFFICIENT_STORAGE
Do I need to do a rest before hitting run or debug from within Eclipse and reloading the application within my emulator?
I have occasionally received that error despite having plenty of room. You can first check to see if you are short on space (in the emulator from home screen: Menu -> Settings -> SD card & phone storage). Internal phone storage is the most important value, and you'll want to uninstall apps if that is low. If your app is set to install to the SD card, make sure that has enough room too.
If you have plenty of room, sometimes you can just retry the install and it will work. It can also help to uninstall the app from the emulator and then install it again. If those solutions don't work, you can restart the emulator. If all else fails, try creating a new AVD.
I have a problem with the Android Emulator and its SD card. I am developing an application that writes files to /sdcard. Everything works fine, until I exit the emulator by clicking its close button. After restart the files are empty (size 0), but still in the directory. Of course, they have not been empty as long as the emulator runs.
This looks like a failed sdcard unplug, like with usb stick. But I am not sure, how the emulator treats the card exactly. I am starting the emulator from Eclipse, and get an error at exit, when I close the emulator.
The problem did not exist before I updated my Android plugin. I could use all my files after restarting the emulator. Moreover, the problem does not occur on the real thing. I am using the most recent Android stuff, and Eclipse 3.5.
I already tried deleting my emulators and creating a new one. I also tried shutting the emulator down with the red telephone button, but that did never complete. Of course, my app is not a service and has no threads pending at shutdown.
Any ideas, you friendly people out there?
I am currently seeing the same problem on mine using an API 4 emulator, but putting the apk on my actual android device it works fine. It only happens if I close the emulator and restart using "Debug As" or "Run As". My current workaround is to start the emulator before running / debugging my app... not shutting down the emulator prevents this from happening, although I wish I had a real fix.
The problem went away by itself. I have no idea, what caused the healing. I did not do anything particular. I just continued working.
Thanks for your attention.