android – Adb transfers file with a very slow speed-ThrowExceptions

Exception or error:

I’m having a problem with adb on my machine, it runs on OSX Yosemite. I was trying to adb install a 44mb apk and it took 5 minutes for the apk to be installed. I try to narrow the problem, and it seems that the adb push has something to do with this.

I tested with adb push -p src dest to see the transfer progress. The transfer works fine for small files, leaving about 1300KB/s transfer rate. It slows down a lot when transferring large files, about 120KB/s transfer rate. The transfer always slows down at byte 8388608/total.

I’ve tested adb push with the same device and same USB cable at my coworker’s Mac using OSX Yosemite and it works fine. I don’t know what causes the problem, could somebody help me?

How to solve:

According to Performance Tuning the Network Stack on Mac OS X Part 2,
edit your /etc/sysctl.conf file as follows and reboot your machine.

kern.ipc.somaxconn=2048
net.inet.tcp.rfc1323=1
net.inet.tcp.win_scale_factor=4
net.inet.tcp.sendspace=1042560
net.inet.tcp.recvspace=1042560
net.inet.tcp.mssdflt=1448
net.inet.tcp.v6mssdflt=1412
net.inet.tcp.msl=15000
net.inet.tcp.always_keepalive=0
net.inet.tcp.delayed_ack=3
net.inet.tcp.slowstart_flightsize=20
net.inet.tcp.local_slowstart_flightsize=9
net.inet.tcp.blackhole=2
net.inet.udp.blackhole=1
net.inet.icmp.icmplim=50

I was faced with the same problem and solved it by the above settings.

###

I was struggling with this, then saw a suggestion to just start a webserver on the host machine and let your android device/emulator just download the apk.

cd build/outputs/apk/
python -m SimpleHTTPServer 8000

Then, in the android device I just open a browser to http://<host_ip>:8000/ – it downloads in seconds.

###

Try use Wi-Fi. Probably, your USB cable is slow or your phone doesn’t support fast high-speed file transfer. Look: How can I connect to Android with ADB over TCP?. I had 30-35 mbps, when I sent 2 GB of GTA SA.

If you don’t have Wi-Fi, you can use Tethering from Android in computer.

Leave a Reply

Your email address will not be published. Required fields are marked *