Error while trying to push/install .apk using adb

爱⌒轻易说出口 提交于 2020-01-03 17:26:13

问题


I've recently started encountering problems while trying to run my application from Android Studio on my MacOS machine. I tried to run the command from adb myself but I still can't get it to work, although the error appears different.

The errors I get are as follows;

Android Studio

10/02 09:54:53: Launching app $ adb push /Users/{username}/{path-to-apk}.apk /data/local/tmp/{package}

java.io.IOException: Broken pipe

Error while Installing APK

adb (via Terminal.app)

$ adb push /Users/{username}/{path-to-apk}.apk /data/local/tmp/{package}

adb: error: 65536-byte write failed: Undefined error: 0

Now I've tried a lot of different things, some of which are just stretches because the problem appears to lie in something adb related, but none of this seems to change anything;

  • Different applications/apks
  • Different Android devices (total of 5)
  • Different USB-ports (all 4, with and without USB-hub).
  • Different (or no) USB-dongles (USB-C to USB-A)
  • Restart/Invalidate Caches (Android Studio)
  • Reinstall Android Studio
  • Reinstall Android SDK
  • New (separate) install of Android SDK through homebrew
  • Reset NVRAM/PRAM
  • Reset SCM
  • Update to MacOS Mojave (and retry all of the above).

At this point I am at a loss. Has anyone encountered these errors before without having any of the above solutions fix it? Next thing on my list is a reinstall of the OS, but that feels like a bit of overkill.

I am running on MacOS Mojave on a 2016 Macbook Pro, but everything appeared to have the same effect on High Sierra.

Edit

Weird update on the behaviour, I can get the installing to work continuously after a restart by doing the following steps;

  • Login
  • Start Terminal.app
  • Manually repeat adb push command
  • (Command executes successfully)
  • Start Android Studio
  • Everything works fine...

However, if I start Android Studio without first manually doing the adb push in Terminal, everything is broken as described above.

Edit 2

Even calling adb start-server in Terminal before starting Android Studio makes everything work. So something appears to be faulty when Android Studio is responsible for starting the adb server..


回答1:


I got the same error. I have no idea but start-server before starting Android-studio




回答2:


Not really an answer but my issue appears to be solved with the latest release of Android Studio.



来源:https://stackoverflow.com/questions/52604360/error-while-trying-to-push-install-apk-using-adb

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!