Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ERROR: Could not execute "adb push" #278

Closed
lvxy-git opened this issue Sep 30, 2018 · 28 comments
Closed

ERROR: Could not execute "adb push" #278

lvxy-git opened this issue Sep 30, 2018 · 28 comments
Labels

Comments

@lvxy-git
Copy link

Got this issue with win10.

can get my device by adb devices

@lvxy-git lvxy-git changed the title ERROR:Could not execute "adb push" ERROR: Could not execute "adb push" Sep 30, 2018
@rom1v rom1v added the adb label Sep 30, 2018
@rom1v
Copy link
Collaborator

rom1v commented Sep 30, 2018

Could you provide more information: what is the command you executed? from which directory? on which platform? what is the whole output?

@lvxy-git
Copy link
Author

lvxy-git commented Oct 1, 2018

I executed "scrcpy" at my scrcpy's directory: “.\scrcpy-win64”
output:ERROR: Could not execute "adb push"
execute “adb devices” can find my device.”
on win10

@npes87184
Copy link
Contributor

npes87184 commented Oct 4, 2018

@lyuxy

Can you test it again in scrcpy 1.4?
In scrcpy 1.4, it will detect whether adb is missing or not (see #236, #254 ).

If the adb is missing when we execute scrcpy, it will show on console.
It helps us to know whether adb is in your PATH or not.

Thanks.

@Plandercozeron
Copy link

Plandercozeron commented Oct 12, 2018

Hello. I'm having 'Could not execute adb push' issue too with 1.4 on Windows 7 x64

  1. I have C:\adb directory in my PATH
  2. I've unpacked scrcpy's zip-package into C:\adb
  3. Called scrcpy from command line and get this error:
ERROR: Failed to execute adb
ERROR: Could not execute "adb push"
Press any key to continue...

But if i unpack archive somewhere else, call command line from that directory and use scrcpy then everything works fine.
Tried to put contents of scrcpy into my user directory from where command line is beeing called if i use PATH, but it won't work - same error.

@rom1v
Copy link
Collaborator

rom1v commented Oct 12, 2018

  1. Called scrcpy from command line and get this error:

What if you call adb devices instead?

The release of scrcpyalready includes adb, you don't need to extract it to some adb directory (it might conflict).

Tried to put contents of scrcpy to my user direcotry from where command line is beeing called if i use PATH, but it won't work - same error.

Sorry, I didn't get that part. Could you explain with a concrete example, please?

@Plandercozeron
Copy link

Case when doesn't work

  1. Have empty directory A which is in PATH
  2. Extract scrcpy into A
  3. Launch CMD by just Win + R -> cmd so CMD starts from current user directory
  4. Call scrcpy - doesn't work
  5. Call adb devices - works

Case when works

  1. Extract scrcpy into directory B
  2. Launch CMD from directory B
  3. Call scrcpy - works

@rom1v
Copy link
Collaborator

rom1v commented Oct 12, 2018

OK, I get it.

The problem is that scrcpy pushes the scrcpy-server.jar that it finds in . (your current directory). If you start scrcpy from PATH, it expects scrcpy-server.jar to be in ., i.e. the current directory, the one from where you call (the Windows version is "portable", it overrides the server path).

If you want your scrcpy-server.jar to be in a directory other than ., you need to give its full path in the env variable SCRCPY_SERVER_PATH.

@Plandercozeron
Copy link

Plandercozeron commented Oct 12, 2018

Yes, that helped. Put scrcpy-server.jar in my user directory C:\Users\your_username . Thought scrcpy couldn't find adb.exe at first. Very useful and works if there're cyryllic symbols in directory path

@lvxy-git
Copy link
Author

@rom1v @npes87184 it still happen in v1.4

ERROR: Failed to execute adb
ERROR: Could not execute "adb push"

@rom1v
Copy link
Collaborator

rom1v commented Oct 26, 2018

@lyuxy Please provide:

  • the current directory path from where you execute scrcpy
  • the content of that directory
  • the content of your PATH variable
  • the result of adb devices

@lvxy-git
Copy link
Author

@rom1v

  • D:\scrcpy-win64
  • 2018/10/26 17:02 .
    2018/10/26 17:02 ..
    2014/11/07 18:41 1,009,664 adb.exe
    2014/11/07 18:41 96,256 AdbWinApi.dll
    2014/11/07 18:41 60,928 AdbWinUsbApi.dll
    2018/10/03 23:23 47,203,328 avcodec-58.dll
    2018/10/03 23:23 6,114,304 avformat-58.dll
    2018/10/03 23:23 653,824 avutil-56.dll
    2018/10/03 23:23 522,066 scrcpy-noconsole.exe
    2018/10/03 23:23 18,802 scrcpy-server.jar
    2018/10/26 17:07 522,242 scrcpy.exe
    2018/10/03 23:23 1,334,272 SDL2.dll
    2018/10/03 23:23 376,832 swresample-3.dll
  • PATH:
    D:\Python\Python37\Scripts;D:\Python\Python37;%USERPROFILE%\AppData\Local\Microsoft\WindowsApps;C:\Users\yl1993\AppData\Roaming\npm;%ANDROID_HOME%tools;%ANDROID_HOME%platform-tools;%ANDROID_HOME%build-tools;%JAVA_HOME%\bin;%ANDROID_HOME%\build-tools\27.0.3;%adb%
  • "adb devices" result:
    D:\scrcpy-win64>adb devices
    List of devices attached
    7a5a545 device

@rom1v
Copy link
Collaborator

rom1v commented Oct 26, 2018

You have adb accessible both from your PATH and the current directory. I don't know which one is chosen.

What is the result of:

.\adb devices
.\adb --version

and

%ANDROID_HOME%platform-tools\adb devices
%ANDROID_HOME%platform-tools\adb --version

?

What if you remove adb.exe from the scrcpy directory?

@lvxy-git
Copy link
Author

All same with these steps—— output :version 1.0.32 and find my android device.
After remove 'adb.exe' from the scrcpy directory ,excute 'scrcpy' ,output the same errors。

@rom1v
Copy link
Collaborator

rom1v commented Oct 26, 2018

version 1.0.32

This is not expected. The adb.exe included in scrcpy is 1.0.40 IIRC (I have currently no Windows to check, but it may not be 1.0.32).

So the problem is probably that Windows uses your old adb.exe which is in your PATH before using that of the current directory.

@lvxy-git
Copy link
Author

i download scrcpy again. now excute “adb version”in scrcpy's file path,output “v1.0.40”,but it doesn‘t work,i still can't use it.

@cotfas
Copy link

cotfas commented May 11, 2019

Hello,

I use the 1.8 version, and I get the same error on mac, tried with adb over usb and wifi and it is the same issue. The adb devices it is showing the phone connected for both cases. How can I fix it? I`ve tried also with compiling the project..

Thank you

@rom1v
Copy link
Collaborator

rom1v commented May 11, 2019

What if you manually execute:

adb push scrcpy-server.jar /data/local/tmp

(adapt the path of scrcpy-server)

@cotfas
Copy link

cotfas commented May 12, 2019

The same issue:

cotfas:scrcpy work$ 
cotfas:scrcpy work$ 
cotfas:scrcpy work$ adb devices
List of devices attached
9889db394248483045	device

cotfas:scrcpy work$ adb push /usr/local/share/scrcpy/scrcpy-server.jar /data/local/tmp
/usr/local/share/scrcpy/scrcpy-server.jar: 1 file pushed. 0.4 MB/s (19850 bytes in 0.047s)
cotfas:scrcpy work$ scrcpy
exec: Permission denied
2019-05-12 12:08:41.901 scrcpy[90214:1912846] ERROR: Failed to execute adb
2019-05-12 12:08:41.901 scrcpy[90214:1912846] ERROR: Could not execute "adb push"
cotfas:scrcpy work$ 

I`ve also posted the issue here:

#530

@vflame
Copy link

vflame commented May 18, 2019

On windows, setting SCRCPY_SERVER_PATH copies the scrcpy binaries to /data/local/tmp/scrcpy-server.jar/.

@rom1v
Copy link
Collaborator

rom1v commented May 18, 2019

Which value do you assign to SCRCPY_SERVER_PATH exactly?

@vflame
Copy link

vflame commented May 18, 2019

Path to the scrcpy-server.jar (e.g. "C:\scrcpy-win64")

@rom1v
Copy link
Collaborator

rom1v commented May 18, 2019

You need to pass its full path: C:\scrcpy-win64\scrcpy-server.jar.

@rom1v
Copy link
Collaborator

rom1v commented Jun 24, 2019

v1.9 fixes the problem by searching in the same directory as the binary on Windows, so I'm closing.

@wangym1551
Copy link

i have this problem too ERROR:could not execute "adb push",and i solved it like this
1、Delete adb in PATH
2、run the scrcpy.exe as administrator

@ghyujkilop
Copy link

i have this problem too ERROR:could not execute "adb push",and i solved it like this
1、Delete adb in PATH
2、run the scrcpy.exe as administrator

Yes! This worked! Thank you! <3

@ShitijHalder
Copy link

What if you manually execute:

adb push scrcpy-server.jar /data/local/tmp

(adapt the path of scrcpy-server)

Same problem!

@jericepon
Copy link

I encountered the same issue. I tried to run it on cmd and it works.

@emsm-chentao
Copy link

I the same issue. Update to the latest version and the problem is solved

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests