- Home /
adb install: connection reset by peer
I'm attempting to build an Android project and test it on my device. Usually, when I try to push the build to my device either through the Unity Build Settings menu (Build and Run option) or manually through the adb install command, I receive an error and the build fails:
adb: error: failed to copy 'C:\Users\Path\To\Project\Temp\StagingArea\Package.apk' to '/data/local/tmp/Package.apk': no response: Connection reset by peer
I also see an stdout print in the log that shows the progress ticking upward. When the connection is reset and fails to build, the final percentage is anywhere between 0% - 99%. Here is a sample:
stdout[
[ 0%] /data/local/tmp/Package.apk
[ 0%] /data/local/tmp/Package.apk
[ 0%] /data/local/tmp/Package.apk
[ 0%] /data/local/tmp/Package.apk
[ 1%] /data/local/tmp/Package.apk
[ 1%] /data/local/tmp/Package.apk
[ 1%] /data/local/tmp/Package.apk
[ 1%] /data/local/tmp/Package.apk
[ 2%] /data/local/tmp/Package.apk
[ 2%] /data/local/tmp/Package.apk
...
[ 41%] /data/local/tmp/Package.apk
However, by disconnecting my device from my PC or rebuilding, I can sometimes (as in, very rarely) successfully push to the device.
Has anyone else encountered this "Connection reset by peer" issue when attempting to install via adb? The error message prompts me to check my Android SDK installation, though the build process will sometimes succeed. Here is the full error message, with the stdout portion truncated:
Error building Player: CommandInvokationFailure: Unable to install APK to device. Please make sure the Android SDK is installed and is properly configured in the Editor. See the Console for more details.
C:/Android\platform-tools\adb.exe -s "64d32755" install -r "C:\Users\Path\To\Project\Temp\StagingArea\Package.apk"
stderr[
]
stdout[
[ 0%] /data/local/tmp/Package.apk
[ 0%] /data/local/tmp/Package.apk
[ 0%] /data/local/tmp/Package.apk
[ 0%] /data/local/tmp/Package.apk
[ 0%] /data/local/tmp/Package.apk
[ 0%] /data/local/tmp/Package.apk
[ 0%] /data/local/tmp/Package.apk
[ 0%] /data/local/tmp/Package.apk
[ 1%] /data/local/tmp/Package.apk
[ 1%] /data/local/tmp/Package.apk
[ 1%] /data/local/tmp/Package.apk
[ 1%] /data/local/tmp/Package.apk
[ 1%] /data/local/tmp/Package.apk
[ 1%] /data/local/tmp/Package.apk
[ 1%] /data/local/tmp/Package.apk
[ 1%] /data/local/tmp/Package.apk
[ 1%] /data/local/tmp/Package.apk
[ 2%] /data/local/tmp/Package.apk
[ 2%] /data/local/tmp/Package.apk
...
[ 41%] /data/local/tmp/Package.apk
adb: error: failed to copy 'C:\Users\Path\To\Project\Temp\StagingArea\Package.apk' to '/data/local/tmp/Package.apk': no response: Connection reset by peer
]
I'm seeing this too. This started recently for me. Today, for example, I was able to push two builds to my device intermittently throughout the day. But for the most part, I was unable to push anything to my device due to this error.
I've updated my sdk, uninstalled and reinstalled my phone drivers on my computer, restarted the phone, restarted the computer, changed usb ports... pretty much all the things the internet says should be the definitive solution. Nothing works.
I'm getting the exact same error for the first time today. Usually I have no issue but both doing it through Unity or the adb install command give me this error. I recently updated to unity 5.5 but besides that I haven't changed anything.
Answer by AVOlight · Nov 28, 2016 at 04:28 AM
switching to a raw USB port worked for me
I have a USB hub and switching ports on the hub didn't work but when I switched to a raw USB port on my PC it worked again
got the USB hub to work again by disconnecting its Power and USB cables for a few seconds
so if you don't have a USB hub i guess you could try a full power off, meaning after shut down removing all power sources for at least 30 secs
$$anonymous$$an, you saved me a lot of hassle. I had it in a USB hub, first time I tried after reading your post it worked. Thank you
Answer by Liinnkk · May 20, 2017 at 08:48 AM
My smartphone is very unstable when it comes to USB connections, so even when I'm moving files from my computer to it, the connection often resets. It's annoying and , but the only way I found to get around this problem when building my game or profiling is to connect to my smartphone through wi-fi. You can do it easily this way:
Open cmd
Go to your Android SDK folder (if in Windows, type "cd C:\Users\YourUser\AppData\Local\Android\sdk\platform-tools").
Type "adb tcpip 5555" (This command is pretty tricky if the next isn't working).
Get your Smartphone's IP and type "adb connect ip" (eg. adb connect 192.168.0.12, note your smartphone MUST be on the same local network).
If it works, a message will be shown telling you are "connected to ip" and the ip:5555 will be listed when you type "adb devices". Then, disconnect your smartphone from USB and Unity will attach to your smartphone through wifi.
Yeah, basically, this solution is the best not only for cases when plain usb debugging drops, but in general, ins$$anonymous$$d of using cables.
Your answer
![](https://koobas.hobune.stream/wayback/20220612090550im_/https://answers.unity.com/themes/thub/images/avi.jpg)