Long time to upload app to emulator - android

It's taking a very long time to upload an app to the emulator, typically several minutes. When I was developing an app for iOS, Xcode would upload the app to iOS Simulator within seconds! Why is it taking so long for the Android emulator? And what can I do to speed it up?

If you have an android phone to plug in and run your app on that, its much quicker than the emulator. Unfortunately the emulator is just pretty slow, there may be things you can do to speed it up slightly, such as keeping it running between tests rather than shutting it down each time, but the best bet is to test on a phone!

Solution:
Go to Run -> Run Configurations... -> Target Tab -> Additional Emulator Command Line Options. Add there:
-netspeed full -netdelay none
After doing this the time for uploading went from 2 minutes to 8 seconds.

HAX is way much faster than normal simulator. Of course, testing device is the best option since some of the features are harder to test on simulator (for example, Gyro, Accelerometer, etc... )

Related

Android Emulator becomes very slow all of a sudden

I am using the Android version 4.0.3 on a Windows system. My emulator was working pretty well, however all of sudden it became very slow.
It is taking too much time in launching so most of the time launch gets cancelled or I have to start the emulator ahead of time.
If you are having long times in emulator startup, you can configure AVD to save a snapshot of emulator. This significantly improves startup time, although the shutdown time will increase due to the saving of snapshot.
If you are having a slow emulator in general (booting and running programs), and, if you are using a Intel x86 processor you can install Intel Hardware Accelerated Execution Manager from android SDK. This will improve emulator speed by more then 10 times compared to the standard emulator. It even faster then a mid range real device.
good luck.
The emulators, all of them, on every platform, are infamous for slow startups. Typically you start the emulator, wait 'til it is all the way up, and then run your program. Debugging on a real device is infinitely preferable.
Leaving the emulator open between program runs is a necessity.
One of my professors gave up and spent several thousand dollars on a new computer with a huge solid-state drive because he could not get an emulator window up in less than five minutes, and it was impacting his ability to teach courses based on the platform. I went the cheaper route and dropped $200 on a tablet. Either way, hardware is the real answer here.

Slow uploads to running Android emulator

I have searched but not found any queries or answers for my specific circumstance. I have a fast new machine with plenty of memory running Windows 7. I'm using the latest Eclipse and Android SDK.
When I run an app the emulator takes about 45 seconds to start (blazingly fast for the emulator!) from run initiation to running my app.
If I then change the app and re-run it on the still-running emulator, the time increases to 70+ seconds! As opposed to all other complaints people have, in my case restarting the emulator is faster than using the existing instance. I don't like that.
Here are the times:
2011-09-29 13:07:13 - hello Uploading hello.apk onto device 'emulator-5554'
2011-09-29 13:07:18 - hello Installing hello.apk...
2011-09-29 13:07:37 - hello Success!
on rerunning after changing the app to get it to reload:
2011-09-29 13:08:18 - hello Uploading hello.apk onto device 'emulator-5554'
2011-09-29 13:09:16 - hello Installing hello.apk...
2011-09-29 13:09:24 - hello Success!
As you can see, the upload to the emulator takes a mere 5 seconds when the emulator is freshly started. It takes nearly a minute with a running emulator! This is the cause of the extended re-running time. This doesn't change even when I uninstall the app on the emulator before re-running it.
Any ideas on what I could try to solve this? It appears to be some kind of communication problem, possibly with adb.
As others have posted, just clicking around in the emulator while uploading drastically improves the upload speed. I had the same problem and Googled for an answer, and trying out this trick helped me. I'm running a 2.3.3 AVD.
My new discovery is a small "hack" how you can make your upload faster. I realized that the cases when the upload was faster were caused by my interaction. So when I upload new app without active working with emulator, it is slow. But when I work with it (testing my application, exiting, opening applications list, etc.), the upload is MUCH faster - in my case approx. 15seconds instead nearly 2 minutes.
So I think, that the problem is somehow in performance settings of the emulator. When I do nothing, it thinks no big performance is needed, emulator is switched to some economic state, so also my upload is slow.
A better solution:
Go to Run -> Run Configurations... -> Target Tab -> Additional Emulator Command Line Options. Add there:
-netspeed full -netdelay none
Now close the emulator and run it again.
After doing this the time for uploading went from 2 minutes to 8 seconds.
Edit:
I have also found that quitting Skype makes my emulator upload much faster.
I have the same problem, I'm developing an android application which is like 4,6MB and it takes me like maybe 50-60 seconds to upload it on emulator and run it.I don't think this is a problem with the communication. The JVM is slow, that's why you need a time to upload your apk and run it.I don't think you can do anything about it, except you start testing your application on a device.
Play with the emulator while uploading your application. I totally agree with teepee. It reduced my waiting time from 4 minutes to 30 secs.
The fastest emulator you can get it's a VMWare machine with Android.
While developing my game, Elastic World, I was suffering from the same problem. After waiting minutes for the emulator to startup, the game was running at 20 FPS maximum. Even on low end android devices I could easily get 60 FPS. The upload speed was very slow.
So I moved to a VMWare Android machine, following the instructions from this site: http://www.android-x86.org/documents/installhowto/
The same game loop now runs at 250 FPS. (it's not playable at this speed and I have the game limited to max 60 FPS, but overriding this limitation it gives 250 FPS)
When Eclipse ends the build process I just have to wait 1 to 5 seconds for the game to appear on the virtual machine. And I'm running an old Core2Duo
This is not an issue with the AVD, it's eclipse the problem and I don't know if there is a way to change it within what we could call the jungle of parameters.
To be brief you can launch an emulator all by yourself in a console command
using the following :
emulator.exe -avd MyAVDName -netspeed full -netdelay none
Nice the parameters, why isn't Eclipse using it?
Some Eclipse coder should make it the default.
Another solution is to switch to IntelliJ IDEA. It will gloriously replace your old clunky IDE with a fresh and better one.
I know this is an old topic, but I think I actually have a solution to this issue.
First you need to boot the emulator without the netspeed arguments like follows:
emulator -avd <name>
Once it's started log in to the emulator using telnet. You can get the port from the top of the emulator window or by running adb devices and looking at the serial for the emulator which is in the form emulator-port (this is usually 5554 in most cases)
telnet localhost 5554
After you've logged in using telnet you need to issue the following command to force the emulator to use a very high network speed
network speed 500000
You can then check this setting in telnet using the following command
network status
Which should return
Current network status:
download speed: 500000000 bits/s (61035.2 KB/s)
upload speed: 500000000 bits/s (61035.2 KB/s)
If you now try to install the APK you should find the performance is dramatically increased. In my case it went from 260s to 18s.
Just thinking out loud:
I don't know this for a fact, but I'm wondering if this slow down is because Android applications each have their own instance of the Dalvik VM and run as a separate user and process. When you "think" you have closed your application, Android may be keeping the process (definitely the VM) alive in case you restart the application. This is similar to the pre-fetch behavior in windows.
When you re-run the application, after modifying the sources, Android perhaps has to destroy the cached instance. The additional delay you notice in the case of re-deployment in the same emulator instance may be because of the costs incurred in gracefully shutting down the VM and the application.
I get the same problem, but I'm convinced it has something to do with the O.S., because I uploaded the same application using a MacBook Pro and a Dell laptop, which is more powerful, given the hardware spec, however the upload time is significantly lower on the Mac.
On this Dell laptop with Windows, however, uploads to actual Android devices are way, way faster.
I thought it might be related to the "Google USB Driver package", that I haven't installed before, but after installing it, nothing really changed.
Try to set your emulator RAM to 1024.
Elaborating on what teepee said in an earlier post, I've found that if I muck with the already-running AVD during the uploading phase, it finishes MUCH quicker (5 seconds vs 60 seconds) and I'm installed and running in a fraction of the time. This is with a 4.0.3 AVD. Haven't tried the others yet.
The alternative ways:
Setting up a FTP server on your pc for hosting apk files, now you can download apk files by android emulator web browser and install app directly whitout using adb.
or
Install a samba client on android emulator and share apk files on your pc, then copy apk files to emulator and install app directly whitout using adb.
All of above ways are faster than adb install.
Silly question - did you try it on several AVDs? It is possible your one AVD is messed up in some way.
Do as much interaction with emulator as you can while uploading the apk on emulator, if you press random buttons of emulator while uploading it will upload early, before it took 5-6 mins to upload but now it take only 15 - 20 secs.
I have seen this too. Here is something that helped, assuming you've been using the same AVD.
Wipe the user data on the AVD. After doing this, it would load the app much faster again, a couple of seconds.
In a terminal/console I shell into the AVD with adb -e shell then go to the tmp directory where the apk is being uploaded cd /data/local/tmp then do ls -l to see the current file size. I've found that if I sit there and keep hitting up arrow then enter to quickly repeat the ls -l the upload speeds up dramatically. You can watch the progress as the file size increases.
This is probably similar to the effect of clicking around in the AVD others have mentioned.
I'm on a Mac. Not sure if it's the same on Windows or Linux.
This might work on windows,
start the Task manager --> processes tab--> look for emulator.exe,
right click and set priority to high
dont forget to set it to normal after your work is done.
also closing unwanted applications which require a lot of memory like chrome and firefox can be closed when not needed.

Speed up Android emulator

I read on many other topics that the Android emulator starts really slow. Indeed, it takes +15 mins to start. However, on my machine is slow even after that.
The 'phone' responds with a 3-4 seconds delay and everything has a huge lag.
Is there any way to improve the performance of my laptop (Asus 1201N) is too rusty for the Android emulator?
PS: Tried in different emulator resolutions and the result is the same
Edit: My laptop has 2 cores with HyperThreading. And it shows as 4 CPU in Device Manager. However, when using the emulator, just one of the graphs is at 100%. Can I do something to make it work multi core?
Do you have "Disable Boot Animation" checked?
Also, if that doesn't fix it, one thing that helps is that you never actually have to close the emulator screen while you're coding. If you click debug when it's already open, your APK will get uploaded to the emulator and start pretty much immediately. For some reason it took me a while to figure out that I didn't have to manually close the emulator.
One thing I learned that helped me is that once the emulator is open from your first debug run you DO NOT have to close it. Leave it open, and on your next debug run it will be ready to go without any load up time like when you first open it.
In regards to your slowness after startup I suspect it's just your computer. It runs very fast for me. It starts up in about 20 seconds or less, and once it's open my subsequent debugs load very fast.
I hope at least my first tip helps to save some of your sanity.
Here's what you can try. It does speed up the emulator for me, especially during loading time.
I noticed the emulator is only using a single core of the available CPU. What I did is to set it to use all available processors.
I'm using Windows 7.
When the android emulator is starting, open up the Task Manager, look under the Process tab, look for "emulator-arm.exe" or "emulator-arm.exe *32" ...right click on it, select Processor Affinity and assign as much processor as you like to the emulator.
I think there is few ways to improve the performance of your Android Emulator like
Use Snapshot, this will improve the boot time for consecutive application running
Use x86 Intel Hardware Accelerator
Use 3rd Party Emulator like BlueStacks
Hopefully it will help you to improve the performance and resolve your problems.
Thanks
I had the same problem and in order to solve it I just disabled all the transition animation effects that are enabled under Spare Parts.
it is way too slow for me too.
(slow on both my Pentium 4 (ubuntu) and my dual core 64 laptop (Windows 7)
apparently it uses QEMU - could I perhaps look for the image file and try a different version of qemu?
Another thing I tried is this: http://www.android-x86.org/ (in vmware)
this seems MUCH faster but I can't get it to see the network!
(right now I just want to test some websites in the brower so seeing the network is a must - I'm not doing native apps just yet)
I discovered that instead of running the 'Debug' target, I just run the 'Run' target. The emulator runs a lot smoother when doing so. I only jump into debug mode if I really need it.
To connect to network from android-x86, you neek to manual setup ip manual by use this command in console mode (Alt + F1):
ifconfig eth0 netmask 255.255.255.0 up
after do that, you can check it by type : netcfg in console and you can see this ip is set at your local wmware
you can check it success by ping ip you had been set in command prompt, and after that, you can use adb connect to connect debugger to your virtual android

Is there any way to reduce the boot up time of Android Emulator provided with android SDK

On my system, i am using eclipse ganymede version along the Android SDK and ADT plugin installed. I have created an android AVD (target android 1.5) with 512MB of memory. Its quite frustrating to see the slow boot up of it. It takes around 4-5 mins to complete its boot-up. Is there any way or tweak to speed up this boot up process.
PC config:
P4 2.4 Ghz with 1 GB ram.
You can use the -no-boot-anim command line option which speeds up the boot process by not showing the boot animation while the emulator starts up. It makes an noticeable difference on my system reducing start up time from around 55 seconds to nearer 45 seconds. (In case you're interested this is on a laptop with a Mobile Core 2 Duo L9400 and 3GB of RAM.)
Use a command line like this to start the emulator:
emulator -no-boot-anim #YourAvdName
where YourAvdName is the name of the Android Virtual Device (AVD) image that you want to start.
There is now way of to speed up the boot process. This is the downside of having a real emulator not just a simulator like the Iphone kit offers.
You don't have to quit the emulator after a test run. Just start the emulator at the beginning of your work and close it after you are finished. If you want to test something very quick I often find it easier to just connect my actual device and run my app on the real device, without waiting for the emulator to start up.
There's no real way to cut the time down significantly, and it performs so poorly as a tablet device, it's barely usable. Bottom line, you need a real device to produce production apps. It's good for learning though.
The "emulator" is widely known for being a simulator. It does not:
come with device roms or known emulation for real world devices
off phone or SMS support
have the ability to open listening sockets for incoming requests
etc etc. It is not an emulator like mame. It's a simulator like the iPhone/iPad simulator.
i started off with the default settings on the AVD manager to create a new AVD and it started up kind of ok, about 1-2 mins. later i deleted that and created a new AVD with 8GB internal memory (like the real device i'm using) and startup didn't! i waited 30 mins but still nothing
so i reverted to the default memory (512MB) and it seems to start ok
but i also noticed, its a bad idea to unclick the hardware buttons options, that causes it to load slow too
install virtualbox and use androVM
much better than the emulator
The option that I select so far is to buy a cheap mobile from Kogan.com and use this is your app tester.
Otherwise you can also go and install Genymotion, which is definitely a ++ tool over AVD through Android Studio.
It is fast as well. However, keep in mind that there are many features that will be missing such as google play services. Thus, it is advisable that you buy a device. With Android supported mobile, you could basically do everything and simulate every events such as swipe shake etc...

Can I tweak my android emulator to make it fast?

I am using the android emulator to run my programs.
But its really slow.
It takes around 90 seconds to startup and show the home screen.
Can I tweak it so that I can reduce this time considerably?
Thanks
I was having a similar problem (thread here). However, mine was taking 10-15 mins. 90 seconds is blazing fast considering a lot of threads in the Android discussion groups. The emulator is slow by nature and the only recommendation I read was to keep the emulator open instead of closing it and rerunning it. However, as mentioned in my thread, if you have a physical Android device, you can just run it on that. It's what I'm doing at the moment and it was top-notch advice. No long waiting time. If you don't have a physical device, then I can only suggest you don't close the emulator between code changes, as the system will recognise the change.
use those 3 options.
emulator --cpu-delay 0 --no-boot-anim --cache ./cache --avd avd_name
the first two are obvious. the third one will make the memory of the emulator kind of persistent. you can point it to any file that does not get destroyed by boot (such happens with /tmp) it's like a always-on hibernating device.
If you absolutely cannot use a physical Android device, what you can do is run the Android OS on Virtualbox, and then get the IP address of the emulated Android. Then you'd connect ADB to the emulator using that IP address. That's the jist of it. I've written a more detailed guide to this approach on my blog. http://www.bobbychanblog.com/2011/07/faster-android-emulator-alternative-using-virtualbox/
The -no-boot-anim parameter is good.
Don't turn the emulator off, just re-launch your app.
For further speedups, try the new snapshot feature, which is described here.
Scaling the emulator down made my emulator load faster...
emulator -cpu-delay 0 -no-boot-anim -cache ./cache -scale 0.8 -avd avd_name
actually these are all great answers, but have u thought of changing the ram from the default 96mb to something like 512? works for me :)
If you have the mobile device with you, it's much quicker (and more reliable) to compile it via USB to the device. It takes around 5 seconds to compile and install on your phone, I never use the emulator anymore - it's just to slow.
Not only is it slow but anything other than static widgets (animation) will struggle to run on the emulator and you will notice lag.
I recommend you to use Genymotion . It's a very fast emulator (less than 10 seconds to run in my case)
It has Google Apps installed also including Google Play App which give the chance to download any app. This is a good feature for testing apps with Maps Api.
You need to install Intel HAXM
open you SDK and install
Create a new AVD
Now when run it you should get this
if not then you will need to install Accelerated Execution Manager
See this Running the new Intel emulator for Android on how can you do this
see how much faster do you get Video
While developing my game, Elastic World, I was suffering from the same problem. After waiting minutes for the emulator to startup, the game was running at 20 FPS maximum. Even on low end android devices I could easily get 60 FPS.
So I moved to a VMWare Android machine, following the instructions from this site: http://www.android-x86.org/documents/installhowto/
The same game loop now runs at 250 FPS. (it's not playable at this speed and I have the game limited to max 60 FPS, but overriding this limitation it gives 250 FPS)
Try to use a smaller resolution for your emulator as for example HVGA. The emulator gets slower the more pixels its needs to render as it is using software rendering.
Also if you have sufficient memory on your computer, add at least 1 GB of memory to your emulator. This is the value "Device ram size" during the creation of the AVD.
Also set the flag "Enabled" for Snapshots. This will save the state of the emulator and let it start much faster.
Just enable "Snapshot" checkbox in your AVD Manager. It will save the state of your AVD when you close it. So, once you run the emulator again, that saved state will be loaded. Hence the boot up time of your AVD will be considerably reduced.
First I follow this introduction
Run emulation with command : emulator -cpu-delay 0 -no-boot-anim -cache ./cache -avd <adv-name> -gpu on (follow link and link)
results is run ~2-3x faster

Categories

Resources