pierlon / scrcpy-docker

Easily run scrcpy with Docker
MIT License
141 stars 33 forks source link

Error java.lang.AssertionError: java.lang.reflect.InvocationTargetException, cant connect device #24

Open mqnoy opened 2 years ago

mqnoy commented 2 years ago

docker-compose.yml

$ cat docker-compose.yml 
version: '3.7'

services:
  scrcpy:
    image: pierlo1/scrcpy:intel
    volumes:
      - /dev/bus/usb:/dev/bus/usb:ro
      - /tmp/.X11-unix:/tmp/.X11-unix:ro
      # preserve authorization keys
      - scrcpy_adb_keys:/root/.android
    environment:
      DISPLAY: $DISPLAY
      ADB_VENDOR_KEYS: /root/.android
    privileged: true
    tty: true
    network_mode: "host"

error log:

INFO: scrcpy 1.16 <https://github.com/Genymobile/scrcpy>
/usr/local/share/scrcpy/scrcpy-server: 1 file pushed, 0 skipped. 3.9 MB/s (33622 bytes in 0.008s)
[server] INFO: Device: Realme RMX1921 (Android 12)
INFO: Renderer: opengl
INFO: OpenGL version: 4.6 (Compatibility Profile) Mesa 20.1.9 (git-53b2b224dc)
INFO: Trilinear filtering enabled
INFO: Initial texture: 1080x2336
WARN: Device disconnected
[server] ERROR: Exception on thread Thread[main,5,main]
java.lang.AssertionError: java.lang.reflect.InvocationTargetException
    at com.genymobile.scrcpy.wrappers.SurfaceControl.setDisplaySurface(SurfaceControl.java:75)
    at com.genymobile.scrcpy.ScreenEncoder.setDisplaySurface(ScreenEncoder.java:216)
    at com.genymobile.scrcpy.ScreenEncoder.internalStreamScreen(ScreenEncoder.java:86)
    at com.genymobile.scrcpy.ScreenEncoder.streamScreen(ScreenEncoder.java:55)
    at com.genymobile.scrcpy.Server.scrcpy(Server.java:76)
    at com.genymobile.scrcpy.Server.main(Server.java:225)
    at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
    at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:355)
Caused by: java.lang.reflect.InvocationTargetException
    at java.lang.reflect.Method.invoke(Native Method)
    at com.genymobile.scrcpy.wrappers.SurfaceControl.setDisplaySurface(SurfaceControl.java:73)
    ... 7 more
Caused by: java.lang.IllegalArgumentException: displayToken must not be null
    at android.view.SurfaceControl$Transaction.setDisplaySurface(SurfaceControl.java:3145)
    at android.view.SurfaceControl.setDisplaySurface(SurfaceControl.java:2214)
    ... 9 more