Home » Android » android – Adb install/uploading of apk taking ages

android – Adb install/uploading of apk taking ages

Posted by: admin June 15, 2020 Leave a comment

Questions:

I never had any problem uploading my applications on my devices (Galaxy SPlus and Nexus 10) but for an unknown reason, now uploading an APK on my Nexus 10 take ages… on 20 times I tried, I reached the end only one time.

Did anyone know how I can debug/verbose APK uploading to know at which speed it goes ? I don’t know what is the way the APK is uploaded, can someone give me a hint of where to look for ? I want to investigate but I don’t know what to do ?

The device is correctly responding to adb commands, I can see it under Eclipse, I can download/upload files with DDMS file explorer, everything is working as usual, but when running/debugging my application, Eclipse get stuck on “Uploading my-application.apk onto device ‘R32D1035MCE'”.

Could you please help ?

EDIT :

I have reseted my device to factory default, it does no help.

Also, I have enabled traces with ADB_TRACE=all in my environment settings, and the trace show that adb is waiting for something, but I have no clue.

EDIT :

Still investigating, my Nexus 10 was working again, and then suddenly it stopped working. In the DDMS log, I have the following error message :

[2013-06-23 01:09:30 - ddmlib] An established connection was aborted by the software in your host machine
java.io.IOException: An established connection was aborted by the software in your host machine
    at sun.nio.ch.SocketDispatcher.write0(Native Method)
    at sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:51)
    at sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:89)
    at sun.nio.ch.IOUtil.write(IOUtil.java:60)
    at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:450)
    at com.android.ddmlib.JdwpPacket.writeAndConsume(JdwpPacket.java:213)
    at com.android.ddmlib.Client.sendAndConsume(Client.java:607)
    at com.android.ddmlib.HandleHeap.sendREAQ(HandleHeap.java:348)
    at com.android.ddmlib.Client.requestAllocationStatus(Client.java:453)
    at com.android.ddmlib.DeviceMonitor.createClient(DeviceMonitor.java:835)
    at com.android.ddmlib.DeviceMonitor.openClient(DeviceMonitor.java:803)
    at com.android.ddmlib.DeviceMonitor.deviceClientMonitorLoop(DeviceMonitor.java:621)
    at com.android.ddmlib.DeviceMonitor.access$100(DeviceMonitor.java:44)
    at com.android.ddmlib.DeviceMonitor$3.run(DeviceMonitor.java:580)

It looks like related to this problem : An established connection was aborted by the software in your host machine

But none of the solutions given are working for me.

Is there a way to reset the network connection that adb is doing with the device ?

EDIT : a solution have been found as suggested by chris-stratton, using “adb install -r package.apk”, usage of -r command switch that force a re-installation unblocks the device frozen state.

How to&Answers:

Ok, I finally found the answer. The reason is that I used another mini USB cable than the one provided with the Nexus device. I’m reproducing it at 100%.

When I use the cable from my Galaxy SPlus, the Nexus don’t want to upload the file (even if the device is recognized, and that everything seems fine). The upload never ends.

And the inverse is true too, when using the USB cable device of my Nexus 10 with my Galaxy SPlus, this time the device itself is not recognized.

I tried that on two different PCs. I thought that mini USB cables were all compatible. But no. The answer I don’t have is : why ?

Answer:

A slight variation of the different USB cable solution is that I just switched USB ports; problem solved. This was even after rebooting both my desktop and phone not being enough.

Answer:

I don’t know how to monitor the upload speed of an APK so the following won’t help speed up the transfer but if what you mean is that the transfer fails because of a time out then you can change that value in Window->Preferences->Android->DDMS->ADB Connection time out.

Mine is set up for 10000 (which is 10s) and rarely fails.

But none of the solutions given are working for me.

There are plenty there, which ones did you try so we know not to propose those?

Is there a way to reset the network connection that adb is doing with the device ?

You can reset ADB from eclipse by going to the DDMS perspective and in the Devices part click on the downward facing triangle near the maximise and minimise buttons for that Devices subwindow to get to a menu that contains Reset ADB.

You can also try to get your device out of USB debugging mode and back in or to reboot it completely (although given that it would have been part of resetting to factory default it is unlikely to work).

Also, does uploading other applications work? If you only have the one project in your workspace try File -> New -> Other -> Android -> Android Sample Project (any of them).

Answer:

I faced this problem as well.
After having typed on the windows command : adb devices, there is (at least) 2 possibilities:

  1. List of devices attached 41006XXXXXXX device
  2. List of devices attached 41006cXXXXXX unauthorized

The second line indicates the problem with the connection of the device to the PC.
I solved it on configuring my mobile for debug and then it worked perfectly.