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

Could not execute "adb push" on Mac #530

Closed
cotfas opened this issue May 12, 2019 · 13 comments
Closed

Could not execute "adb push" on Mac #530

cotfas opened this issue May 12, 2019 · 13 comments

Comments

@cotfas
Copy link

cotfas commented May 12, 2019

Hello,

I`m trying to use the app on macbook pro mojave with android sdk set to PATH and ADB set to PATH and no mater what method I use I get:

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

cotfas:scrcpy work$ scrcpy
exec: Permission denied
2019-05-12 01:24:06.902 scrcpy[80573:1648708] ERROR: Failed to execute adb
2019-05-12 01:24:06.902 scrcpy[80573:1648708] ERROR: Could not execute "adb push"

Ive tried also to build the src manually and ./run /x but the same issue, Im using it with Samsung S8 non-root.

ENV Var:

export ADB=~/Library/Android/sdk/platform-tools/
export ANDROID_HOME=~/Library/android/sdk/

*both paths are exported to PATH

ADB Version:

cotfas:scrcpy work$ adb
Android Debug Bridge version 1.0.41
Version 28.0.3-5475833

I`ve also tried to remove the ADB from the path and I get the same error.

Vlad

@cotfas
Copy link
Author

cotfas commented May 12, 2019

Also tried with:

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$

And also tried with an Samsung S4 mini, the same issue

@rom1v
Copy link
Collaborator

rom1v commented May 12, 2019

@cotfas

which adb
ADB=$(which adb) scrcpy

?

@cotfas
Copy link
Author

cotfas commented May 12, 2019

It worked

cotfas:bin work$ which adb
/Users/work/Library/Android/sdk/platform-tools//adb
cotfas:bin work$ 
cotfas:bin work$ ADB=$(which adb) scrcpy
/usr/local/Cellar/scrcpy/1.8/share/scr...shed. 1.7 MB/s (19850 bytes in 0.011s)
2019-05-12 12:30:49.043 scrcpy[91360:1941974] INFO: Initial texture: 1080x2216

PS: I`ve tried from windows, it works out of the box when running the exe.

For the mac version what changes I should do in order to work with scrcpy directly?

Thank you

@rom1v
Copy link
Collaborator

rom1v commented May 12, 2019

cotfas:bin work$ which adb
/Users/work/Library/Android/sdk/platform-tools//adb
echo $PATH

You probably have an unexpected trailing / in your PATH after platform-tools. Try to remove it, so that which adb prints /Users/work/Library/Android/sdk/platform-tools/adb.

Then check if that fixes the problem.

@rom1v
Copy link
Collaborator

rom1v commented May 12, 2019

Oh, no! I didn't notice in your first post:

export ADB=~/Library/Android/sdk/platform-tools/

You just make scrcpy use this path as adb executable (it's a directory, not an executable, so it cannot exec it).

Replace it by:

export ADB=~/Library/Android/sdk/platform-tools/adb

scrcpy/app/src/command.c

Lines 13 to 21 in 39b5893

static inline const char *
get_adb_command(void) {
if (!adb_command) {
adb_command = getenv("ADB");
if (!adb_command)
adb_command = "adb";
}
return adb_command;
}

@cotfas
Copy link
Author

cotfas commented May 12, 2019

Replaced, now it works.

Thank you!

@rom1v rom1v closed this as completed May 12, 2019
rom1v added a commit that referenced this issue May 12, 2019
When the execution of an adb command fails, print the command. This will
help to understand what went wrong.

See <#530>.
@rom1v
Copy link
Collaborator

rom1v commented May 12, 2019

@cotfas I added a commit to log adb commands on error: e443518

In your case, it would have printed:

exec: No such file or directory
ERROR: Command not found: [/Users/work/Library/Android/sdk/platform-tools/], [push], [/usr/local/share/scrcpy/scrcpy-server.jar], [/data/local/tmp/scrcpy-server.jar]
ERROR: (make 'adb' accessible from your PATH or define its fullpath in the ADB environment variable)
ERROR: Could not execute "adb push"

The mistake would have been obvious.

@cotfas
Copy link
Author

cotfas commented May 12, 2019

Not 100% sure but last night I've checked with the adb in PATH as well, as it was working from the terminal from other folder, but at the moment it works so far. I'm happy with it! Keep up the good work! :)

@rom1v
Copy link
Collaborator

rom1v commented May 12, 2019

Not 100% sure but last night I've checked with the adb in PATH as well

The value defined in ADB has the highest priority. If it is wrong, even if adb is in your PATH, it will not work.

@cotfas
Copy link
Author

cotfas commented May 12, 2019

It seems for the Samsung S4 mini I get

cotfas:~ work$ scrcpy
/usr/local/Cellar/scrcpy/1.8/share/scr...shed. 2.4 MB/s (19850 bytes in 0.008s)
adb: error: closed
2019-05-12 16:58:54.009 scrcpy[5149:2264353] ERROR: "adb reverse" returned with value 1
2019-05-12 16:58:54.009 scrcpy[5149:2264353] WARN: 'adb reverse' failed, fallback to 'adb forward'
27183

On the S8, it works.

@rom1v
Copy link
Collaborator

rom1v commented May 12, 2019

Scrcpy requires at least Android 5, I guess your S4 mini has Android 4, right?

The adb command error is printed on "unexpected" error.

For adb reverse, scrcpy accepts it and fallbacks to adb forward if it fails, due to a bug preventing adb reverse to work on TCP/IP (see #5). But adb reverse happens to be implemented since Android 5, so it will also fail on Android < 5, but it is not supported anyway, as other things are broken before Android 5).

@cotfas
Copy link
Author

cotfas commented May 12, 2019

Yes, it has android 4.

I understand, no problem. :)

@cotfas
Copy link
Author

cotfas commented May 13, 2019

When using multiple devices

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

cotfas:~ work$ scrcpy -s DUM0219319006848
/usr/local/Cellar/scrcpy/1.8/share/scrcpy/scrcpy-server.jar: 1 file pushed. 2.5 MB/s (19850 bytes in 0.008s)
bind: Address already in use
2019-05-13 19:25:53.804 scrcpy[38593:5019732] ERROR: Could not listen on port 27183
cotfas:~ work$ 

In theory, the computer is listening only until the device is connected. So if you wait ~1 second, you should be able to start another device (unless it crashed or you killed at the wrong time, you'll have to wait more).

Anyway, you can use another (free) port:

scrcpy -p 12345

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

No branches or pull requests

2 participants