Failed to install myapp.apk on device 'emulato

2020-02-06 10:43发布

问题:

I'm trying to run an android app but it's throwing these three lines in red.

[2012-07-08 20:39:23 - myapp] Failed to install myapp.apk on device 'emulator-5554': An attempt was made to access a socket in a way forbidden by its access permissions
[2012-07-08 20:39:23 - myapp] java.io.IOException: An attempt was made to access a socket in a way forbidden by its access permissions
[2012-07-08 20:39:23 - myapp] Launch canceled!

I've put the tools and plateform folder into enviormental variable and also tried every possible thing which can be done but nothing change.

I've tried it installing manually and its says by "adb install myapp.apk" and I get

protocol error
rm failed for /data/local/tmp/myapp.apk, No such file or directory

Edited: I can't install anything using SDK Manager I m getting

Fetching URL: http://developer.sonymobile.com/edk/android/repository.xml
Permission denied: recv failed
Done. Nothing was installed.

kindly help me to resolve it

thanks

回答1:

Try window->show view->devices->view menu->Reset adb and again run application.



回答2:

Two primary reasons for ADB's protocol error are:

  1. Zombie ADB process (e.g. adb.exe in Windows's task-manager or just adb in Linux ps -aux)
  2. Default ADB port (e.g. 5037, 5554, 5555 etc) being occupied by some other process(es).

For both of these issues, the easiest solution is to kill the zombie or the port-blocking process. I explained the steps for both Windows and Linux here: adb kill-server not responding?

You may also try launching ADB with a non-default port. The steps are explained here: Changing default port (i.e. 5037) on which adb server runs

On Windows, I started getting this issue out of nowhere and was driving me nuts. I am happy that I could find the root of the issue. Hope this helps you too. Cheers!



回答3:

Was having the same issue, turns out was simply because I was using a USB extension cable. Removing that fixed it.