开发者

Slow uploads to running Android emulator

开发者 https://www.devze.com 2023-04-09 02:08 出处:网络
I have searched but not开发者_Go百科 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 And

I have searched but not开发者_Go百科 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消