Skip to content

adb: error: cannot stat 'scrcpy-server.jar': No such file or directory #567

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

Closed
H1-N1 opened this issue May 31, 2019 · 14 comments
Closed

adb: error: cannot stat 'scrcpy-server.jar': No such file or directory #567

H1-N1 opened this issue May 31, 2019 · 14 comments

Comments

@H1-N1
Copy link

H1-N1 commented May 31, 2019

hi
when i start scrcpy from a process with administrator privileges i get this error
adb: error: cannot stat 'scrcpy-server.jar': No such file or directory
i dont now how to add full path in the env variable SCRCPY_SERVER_PATH !!!
thanks

@npes87184
Copy link
Contributor

Hi, @H1-N1

What's your operating system?

Thanks.

@rom1v
Copy link
Collaborator

rom1v commented May 31, 2019

Many people are annoyed on Windows with this problem.

The cause is that it looks for scrcpy-server.jar in the current directory (.), not the same directory as scrcpy.exe: #278 (comment)

We should change that for Windows: if SCRCPY_SERVER_PATH is not set, then we need to use the directory of scrcpy, then append scrcpy-server.jar. Ref: https://stackoverflow.com/questions/2647429/c-windows-path-to-the-folder-where-the-executable-is-located/2647446#2647446

@H1-N1
Copy link
Author

H1-N1 commented May 31, 2019

Windows @npes87184

@H1-N1
Copy link
Author

H1-N1 commented May 31, 2019

@rom1v or just add args that take care of server path
Becose i allready set SCRCPY_SERVER_PATH but I get the same error
Thanks for you replay guys

@rom1v
Copy link
Collaborator

rom1v commented May 31, 2019

@H1-N1 What did you do exactly?

Here is how it works.

If you launch scrcpy from its own directory (either by typing scrcpy from that directory in a terminal, or by double-clicking on scrcpy.exe from your file browser), it should work as is (unless you set SCRCPY_SERVER_PATH to a wrong value). To make it work, just unset that environment variable, and retry (start a new terminal after you unset it).

If instead you added the scrcpy directory in your PATH, and try to launch scrcpy from another directory, then you need to set SCRCPY_SERVER_PATH to the full path of the jar file (e.g. C:\Users\h1n1\scrcpy\scrcpy-server.jar).

@H1-N1
Copy link
Author

H1-N1 commented Jun 1, 2019

@rom1v
im lunching scrcpy from a process with administrator privileges
this is way he well not see service.jar this is why i sugest to add a agrs to scrcpy newer version
set path well not resolve the problem at all...

@rom1v
Copy link
Collaborator

rom1v commented Jun 1, 2019

From which directory do you start scrcpy? (which is your current directory and what command do you enter?)

What is the exact value assigned to your SCRCPY_SERVER_PATH? Is it defined for your system (not only your user)?

@iw0nderhow
Copy link

I also get this error on Ubuntu, where scrcpy looks in /usr/local/bin/scrcpy-server.jar (scrcpy's install directory) instead of /usr/local/share/scrcpy/scrcpy-server.jar.

@rom1v
Copy link
Collaborator

rom1v commented Jun 12, 2019

@Karottenbaum If you git clone/git pull this morning, please update to current master.

There was an issue: 53310a9.

@iw0nderhow
Copy link

Thanks, it's working with that commit. Sorry for the trouble!

@hrk
Copy link

hrk commented Jun 24, 2019

@rom1v using the official v1.9 tag, both if manually passing -Dportable=false or applying the fix in 53310a9 I still get a failure during build with the following message.

In file included from ../scrcpy-1.9/app/src/server.c:12:
../scrcpy-1.9/app/src/server.c: In function ‘get_server_path’:
../scrcpy-1.9/app/src/server.c:18:53: error: expected ‘)’ before ‘SERVER_FLENAME’
 #define DEFAULT_SERVER_PATH PREFIX "/share/scrcpy/" SERVER_FLENAME
                                                     ^~~~~~~~~~~~~~
../scrcpy-1.9/app/src/log.h:7:62: note: in definition of macro ‘LOGD’
 #define LOGD(...) SDL_LogDebug(SDL_LOG_CATEGORY_APPLICATION, __VA_ARGS__)
                                                              ^~~~~~~~~~~
../scrcpy-1.9/app/src/server.c:31:27: note: in expansion of macro ‘DEFAULT_SERVER_PATH’
     LOGD("Using server: " DEFAULT_SERVER_PATH);
                           ^~~~~~~~~~~~~~~~~~~
../scrcpy-1.9/app/src/server.c:18:53: error: expected ‘;’ before ‘SERVER_FLENAME’
 #define DEFAULT_SERVER_PATH PREFIX "/share/scrcpy/" SERVER_FLENAME
                                                     ^~~~~~~~~~~~~~
../scrcpy-1.9/app/src/server.c:33:12: note: in expansion of macro ‘DEFAULT_SERVER_PATH’
     return DEFAULT_SERVER_PATH;
            ^~~~~~~~~~~~~~~~~~~

I'm a bit rusty with C, but from what I remember, using #define to declare a macro, accepts only 1 parameter, so server.c at lines 18 and 19 look wrong to me:

#define DEFAULT_SERVER_PATH PREFIX "/share/scrcpy/" SERVER_FLENAME
#define DEVICE_SERVER_PATH "/data/local/tmp/" SERVER_FILENAME

and the ninja build fails due to this. Am I missing something?

@rom1v
Copy link
Collaborator

rom1v commented Jun 24, 2019

@hrk You also need the commit before: bcd0a87.

I'm a bit rusty with C, but from what I remember, using #define to declare a macro, accepts only 1 parameter, so server.c at lines 18 and 19 look wrong to me

In C, you can concatenate string literals by just writing them one after the other:

const char *s = "hello" " world" "!";

This is what the macro does.

@hrk
Copy link

hrk commented Jun 24, 2019

Wow, didn't know about that. And didn't notice the spelling mistake. :) Thank you, it's working now.

@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.

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

No branches or pull requests

5 participants