scrcpy and react-native using same adb instance

Created on 18 May 2019  路  15Comments  路  Source: Genymobile/scrcpy

When I start

$ react-native run-android

the react native server use the same ADB as SCRCPY and it shut down my screen mirror, and if I run the scrcpy.exe it shut down the the connection over react-native and my device.

How I can the 2 services without conflict?

adb

Most helpful comment

You can specify a custom adb path for scrcpy by setting the ADB environment variable:

ADB=/path/to/adb scrcpy

Please add this to readme

All 15 comments

Use the same adb version for both.

You can specify a custom adb path for scrcpy by setting the ADB environment variable:

ADB=/path/to/adb scrcpy

You can specify a custom adb path for scrcpy by setting the ADB environment variable:

ADB=/path/to/adb scrcpy

Please add this to readme

Hi, @Plandercozeron

It is great and free for opening a PR, if you think it is a good thing!

Thanks.

when i run ABD=/path/to/adb, this happens
[/media/expertsofts/01D29959D09B3F60/Linux_Programs/Android/Sdk/platform-tools/adb], [push], [/usr/local/share/scrcpy/scrcpy-server.jar], [/data/local/tmp/scrcpy-server.jar]
ERROR: Could not execute "adb push"

What if you execute the command manually:

/media/expertsofts/01D29959D09B3F60/Linux_Programs/Android/Sdk/platform-tools/adb push /usr/local/share/scrcpy/scrcpy-server.jar /data/local/tmp/scrcpy-server.jar

?

What if you execute the command manually:

/media/expertsofts/01D29959D09B3F60/Linux_Programs/Android/Sdk/platform-tools/adb push /usr/local/share/scrcpy/scrcpy-server.jar /data/local/tmp/scrcpy-server.jar

?

I get thsi error

adb: error: failed to read all of '/usr/local/share/scrcpy/scrcpy-server.jar': Permission denied
/usr/local/share/scrcpy/scrcpy-server.jar: 0 files pushed.

FYI. There was no directory like /usr/local/share/scrcpy. I copied contents from /snap/scrcpy/127/usr/local/share/scrcpy/scrcpy-server.jar and pasted over there and set up SCRCPY_SERVER (or so) path manually.

Sorry. I ran that command with sudo and it executed but the problem is still there. When i run scrcpy, i still get

adb server version (41) doesn't match this client (39); killing...

There seems to be two instances of adb running

See https://github.com/Genymobile/scrcpy/issues/599#issuecomment-503904290.

I ran that command with sudo

(you should not do that)

Hey..
I changed the environment variable to ADB=/path/to/adb and it works perfect..
But what I am wondering about is why the environment variable should execute
scrcpy in my case it couldn't find this command and so I used only ADB=/path/to/adb
and as I said it works
-> Is there any reason for executing scrcpy

Thank you ^^

On which system?

On _bash_ (typically on Linux), VAR1=value1 VAR2=value2 executable executes executable with the modified environment.

I use windows 10

Then do it in two steps: set the environment variable, then execute scrcpy.

Yeah, I've done it this way before... -> in windows is no need for executing scrcpy in the environment variable..

If anyone else has problems, this is how I managed to make it work:

  1. first, find out where your ADB is installed using
adb --version
Android Debug Bridge version 1.0.41
Version 30.0.2-6538114
Installed as /home/chris/Android/Sdk/platform-tools/adb
  1. run scrcpy with that
    ADB=/home/chris/Android/Sdk/platform-tools/adb scrcpy

note1: my which adb returns /usr/bin/adb and that did not work
note2: if you connection drops problems from react-native side, run adb reverse tcp:8081 tcp:8081

Was this page helpful?
0 / 5 - 0 ratings

Related issues

YurieCo picture YurieCo  路  4Comments

SamuelBlickle picture SamuelBlickle  路  3Comments

singleNeuron picture singleNeuron  路  3Comments

udit7395 picture udit7395  路  4Comments

qymspace picture qymspace  路  3Comments