Genymobile / scrcpy

Display and control your Android device
Apache License 2.0
111.57k stars 10.69k forks source link

Failed scrcpy with ASUS Zenfone max #3709

Open hisa13 opened 1 year ago

hisa13 commented 1 year ago

Environment

When I tried to use scrcpy for adb connected zenfone max m2, it failed and output is below.

how can I solve this error?

$ scrcpy
scrcpy 1.25 <https://github.com/Genymobile/scrcpy>
/usr/local/Cellar/scrcpy/1.25/share/scrcpy/scrcpy-server: 1 file pushed, 0 skipped. 8.3 MB/s (42151 bytes in 0.005s)
[server] INFO: Device: asus ASUS_X01AD (Android 11)
2023-01-31 18:10:04.640 scrcpy[59126:2026576] INFO: Renderer: metal
2023-01-31 18:10:04.681 scrcpy[59126:2026576] INFO: Initial texture: 720x1520
[server] ERROR: Encoding error: java.lang.IllegalStateException: null
[server] INFO: Retrying with -m1280...
[server] ERROR: Encoding error: java.lang.IllegalStateException: null
[server] INFO: Retrying with -m1024...
[server] ERROR: Encoding error: java.lang.IllegalStateException: null
[server] INFO: Retrying with -m800...
[server] ERROR: Encoding error: java.lang.IllegalStateException: null2023-01-31 18:10:05.543 scrcpy[59126:2026576] WARN: Device disconnected

[server] ERROR: Exception on thread Thread[main,5,main]
java.lang.IllegalStateException
    at android.media.MediaCodec.native_dequeueOutputBuffer(Native Method)
    at android.media.MediaCodec.dequeueOutputBuffer(MediaCodec.java:3452)
    at com.genymobile.scrcpy.ScreenEncoder.encode(ScreenEncoder.java:152)
    at com.genymobile.scrcpy.ScreenEncoder.internalStreamScreen(ScreenEncoder.java:102)
    at com.genymobile.scrcpy.ScreenEncoder.streamScreen(ScreenEncoder.java:74)
    at com.genymobile.scrcpy.Server.scrcpy(Server.java:100)
    at com.genymobile.scrcpy.Server.main(Server.java:334)
    at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
    at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:399)
2023-01-31 18:10:06.545 scrcpy[59126:2026580] WARN: Killing the server...
zsh: exit 2     scrcpy

thanks in advance

ohager commented 1 year ago

Zenfone 9 similar issue

$ scrcpy
INFO: scrcpy 1.12.1 <https://github.com/Genymobile/scrcpy>
/usr/share/scrcpy/scrcpy-server: 1 fil...shed. 9.1 MB/s (24773 bytes in 0.003s)
[server] ERROR: Exception on thread Thread[main,5,main]
INFO: Initial texture: 1080x2400
WARN: Device disconnected

Error Messages changes from time to time:

$ scrcpy
INFO: scrcpy 1.12.1 <https://github.com/Genymobile/scrcpy>
/usr/share/scrcpy/scrcpy-server: 1 fil...shed. 3.3 MB/s (24773 bytes in 0.007s)
INFO: Initial texture: 1080x2400
[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:178)
    at com.genymobile.scrcpy.ScreenEncoder.streamScreen(ScreenEncoder.java:70)
    at com.genymobile.scrcpy.Server.scrcpy(Server.java:34)
    at com.genymobile.scrcpy.Server.main(Server.java:163)
    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)
    ... 6 more
Caused by: java.lang.IllegalArgumentException: displayToken must not be null
    at android.view.SurfaceControl$Transaction.setDisplaySurface(SurfaceControl.java:3441)
    at android.view.SurfaceControl.setDisplaySurface(SurfaceControl.java:2379)
    ... 8 more
WARN: Device disconnected
rom1v commented 1 year ago

Use the latest version (1.12.1 is very old). Android 12 requires at least scrcpy 1.18.