scrcpy icon indicating copy to clipboard operation
scrcpy copied to clipboard

SCRCPY Broken for Android 14 QPR3 Beta

Open MemeCornucopia opened this issue 1 year ago • 15 comments

  • [x] I have read the FAQ.
  • [x] I have searched in existing issues.

Environment

  • OS: Windows
  • scrcpy version: v2.3.1
  • installation method: Windows Release
  • Google Pixel 7 pro
  • Android version: Android 14 QPR3 Beta 1

Describe the bug After installing Android 14 QPR3 Beta 1 scrcpy doesnt work. I think they changed the method.

[server] INFO: Device: [Google] google Pixel 7 Pro (Android 14)
[server] ERROR: Exception on thread Thread[video,5,main]
java.lang.AssertionError: java.lang.NoSuchMethodException: android.view.SurfaceControl.createDisplay [class java.lang.String, boolean]
        at com.genymobile.scrcpy.wrappers.SurfaceControl.createDisplay(SurfaceControl.java:85)
        at com.genymobile.scrcpy.ScreenCapture.createDisplay(ScreenCapture.java:77)
        at com.genymobile.scrcpy.ScreenCapture.start(ScreenCapture.java:38)
        at com.genymobile.scrcpy.SurfaceEncoder.streamScreen(SurfaceEncoder.java:72)
        at com.genymobile.scrcpy.SurfaceEncoder.lambda$start$0$com-genymobile-scrcpy-SurfaceEncoder(SurfaceEncoder.java:253)
        at com.genymobile.scrcpy.SurfaceEncoder$$ExternalSyntheticLambda0.run(Unknown Source:4)
        at java.lang.Thread.run(Thread.java:1012)
Caused by: java.lang.NoSuchMethodException: android.view.SurfaceControl.createDisplay [class java.lang.String, boolean]
        at java.lang.Class.getMethod(Class.java:2937)
        at java.lang.Class.getMethod(Class.java:2449)
        at com.genymobile.scrcpy.wrappers.SurfaceControl.createDisplay(SurfaceControl.java:83)
        ... 6 more
INFO: Renderer: direct3d
ERROR: Demuxer 'audio': stream disabled due to connection error
INFO: Texture: 1440x3120
WARN: Device disconnected

MemeCornucopia avatar Feb 09 '24 00:02 MemeCornucopia

[server] INFO: Device: [Google] google Pixel 8 Pro (Android 14)
[server] ERROR: Exception on thread Thread[video,5,main]
java.lang.AssertionError: java.lang.NoSuchMethodException: android.view.SurfaceControl.createDisplay [class java.lang.String, boolean]
        at com.genymobile.scrcpy.wrappers.SurfaceControl.createDisplay(SurfaceControl.java:85)
        at com.genymobile.scrcpy.ScreenCapture.createDisplay(ScreenCapture.java:77)
        at com.genymobile.scrcpy.ScreenCapture.start(ScreenCapture.java:38)
        at com.genymobile.scrcpy.SurfaceEncoder.streamScreen(SurfaceEncoder.java:72)
        at com.genymobile.scrcpy.SurfaceEncoder.lambda$start$0$com-genymobile-scrcpy-SurfaceEncoder(SurfaceEncoder.java:253)
        at com.genymobile.scrcpy.SurfaceEncoder$$ExternalSyntheticLambda0.run(Unknown Source:4)
        at java.lang.Thread.run(Thread.java:1012)
Caused by: java.lang.NoSuchMethodException: android.view.SurfaceControl.createDisplay [class java.lang.String, boolean]
        at java.lang.Class.getMethod(Class.java:2937)
        at java.lang.Class.getMethod(Class.java:2449)
        at com.genymobile.scrcpy.wrappers.SurfaceControl.createDisplay(SurfaceControl.java:83)
        ... 6 more
INFO: Renderer: direct3d
ERROR: Demuxer 'audio': stream disabled due to connection error
INFO: Texture: 1344x2992
WARN: Device disconnected

dhwz avatar Feb 09 '24 06:02 dhwz

Please post your framework.jar:

adb pull /system/framework/framework.jar

rom1v avatar Feb 09 '24 06:02 rom1v

framework.zip

dhwz avatar Feb 09 '24 06:02 dhwz

@rom1v

frameworrk.jar

sorry for the late reply.

MemeCornucopia avatar Feb 09 '24 07:02 MemeCornucopia

I had already posted it above

dhwz avatar Feb 09 '24 07:02 dhwz

I had already posted it above

Congrats! 🥳🎊

MemeCornucopia avatar Feb 09 '24 07:02 MemeCornucopia

Thank you for your framework.jar.

Indeed, they removed the method. There was a lot of refactor in Android regarding the display starting in Android 14 (#3927, #4011), it seems they are continuing the work, which causes a lot of changes.

This will require investigations to adapt the code (but the AOSP sources where the method is removed are not available yet).

Refs #4646.

rom1v avatar Feb 09 '24 07:02 rom1v

Please test this fix (the link to scrcpy-server in the comment): https://github.com/Genymobile/scrcpy/pull/4657#issuecomment-1935845644

rom1v avatar Feb 09 '24 12:02 rom1v

@rom1v Can confirm it works

MemeCornucopia avatar Feb 09 '24 14:02 MemeCornucopia

@rom1v Thank you - the updated scrcpy-server has resolved this issue for me also. Same device and Android version as @MemeCornucopia

pier-da avatar Feb 10 '24 13:02 pier-da

I'll add that scrcpy does manage to turn my Pixel 7's screen off before it crashes

adb connect `netstat -nr |head|grep default|awk '{ print $2 }'` ; scrcpy --stay-awake --turn-screen-off  --power-off-on-close  -e
already connected to 192.168.12.67:5555
scrcpy 2.3.1 <https://github.com/Genymobile/scrcpy>
INFO: ADB device found:
INFO:     --> (tcpip)  192.168.12.67:5555              device  Pixel_7
/opt/homebrew/Cellar/scrcpy/2.3.1/share/scrcpy/scrcpy-server: 1 file pushed, 0 skipped. 198.3 MB/s (66007 bytes in 0.000s)
[server] INFO: Device: [Google] google Pixel 7 (Android 14)
INFO: Renderer: metal
[server] ERROR: Exception on thread Thread[video,5,main]
java.lang.AssertionError: java.lang.NoSuchMethodException: android.view.SurfaceControl.createDisplay [class java.lang.String, boolean]
	at com.genymobile.scrcpy.wrappers.SurfaceControl.createDisplay(SurfaceControl.java:85)
	at com.genymobile.scrcpy.ScreenCapture.createDisplay(ScreenCapture.java:77)
ERROR: Demuxer 'audio': stream disabled due to connection error
	at com.genymobile.scrcpy.ScreenCapture.start(ScreenCapture.java:38)
	at com.genymobile.scrcpy.SurfaceEncoder.streamScreen(SurfaceEncoder.java:72)
	at com.genymobile.scrcpy.SurfaceEncoder.lambda$start$0$com-genymobile-scrcpy-SurfaceEncoder(SurfaceEncoder.java:253)
	at com.genymobile.scrcpy.SurfaceEncoder$$ExternalSyntheticLambda0.run(Unknown Source:4)
	at java.lang.Thread.run(Thread.java:1012)
Caused by: java.lang.NoSuchMethodException: android.view.SurfaceControl.createDisplay [class java.lang.String, boolean]
	at java.lang.Class.getMethod(Class.java:2937)
	at java.lang.Class.getMethod(Class.java:2449)
	at com.genymobile.scrcpy.wrappers.SurfaceControl.createDisplay(SurfaceControl.java:83)
	... 6 more
ERROR: Demuxer error
[server] ERROR: Audio capture error
java.lang.InterruptedException
	at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:1638)
	at java.util.concurrent.ArrayBlockingQueue.take(ArrayBlockingQueue.java:420)
	at com.genymobile.scrcpy.AudioEncoder.inputThread(AudioEncoder.java:91)
	at com.genymobile.scrcpy.AudioEncoder.lambda$encode$1$com-genymobile-scrcpy-AudioEncoder(AudioEncoder.java:195)
	at com.genymobile.scrcpy.AudioEncoder$$ExternalSyntheticLambda2.run(Unknown Source:4)
	at java.lang.Thread.run(Thread.java:1012)
scrcpy --version
scrcpy 2.3.1 <https://github.com/Genymobile/scrcpy>

Dependencies (compiled / linked):
 - SDL: 2.28.5 / 2.30.0
 - libavcodec: 60.3.100 / 60.31.102
 - libavformat: 60.3.100 / 60.16.100
 - libavutil: 58.2.100 / 58.29.100
 - libusb: - / 1.0.27

Edit: @rom1v works for me, too!

ballo avatar Feb 11 '24 04:02 ballo

sweet I thought my Pixel 7 with a dead screen was not working \ USB debugging issue with my PC, I just looked and saw it was a different error (same as above) so I came to look in here and found you guys digging into it.

flawlessly worked after replacing scrpy-server with the updated one. thanks!

vonDubenshire avatar Feb 11 '24 18:02 vonDubenshire

Please test this fix (the link to scrcpy-server in the comment): #4657 (comment)

doesnt work for Poco M5S on Android 13.

[server] ERROR: Could not invoke method
java.lang.reflect.InvocationTargetException
        at java.lang.reflect.Method.invoke(Native Method)
        at com.genymobile.scrcpy.wrappers.InputManager.injectInputEvent(InputManager.java:37)
        at com.genymobile.scrcpy.Device.injectEvent(Device.java:230)
        at com.genymobile.scrcpy.Device.injectEvent(Device.java:234)
        at com.genymobile.scrcpy.Controller.injectTouch(Controller.java:323)
        at com.genymobile.scrcpy.Controller.handleEvent(Controller.java:138)
        at com.genymobile.scrcpy.Controller.control(Controller.java:83)
        at com.genymobile.scrcpy.Controller.lambda$start$0$com-genymobile-scrcpy-Controller(Controller.java:91)
        at com.genymobile.scrcpy.Controller$$ExternalSyntheticLambda1.run(Unknown Source:4)
        at java.lang.Thread.run(Thread.java:1012)
Caused by: java.lang.SecurityException: Injecting input events requires the caller (or the source of the instrumentation, if any) to have the INJECT_EVENTS permission.
        at android.os.Parcel.createExceptionOrNull(Parcel.java:3011)
        at android.os.Parcel.createException(Parcel.java:2995)
        at android.os.Parcel.readException(Parcel.java:2978)
        at android.os.Parcel.readException(Parcel.java:2920)
        at android.hardware.input.IInputManager$Stub$Proxy.injectInputEventToTarget(IInputManager.java:1294)
        at android.hardware.input.InputManager.injectInputEvent(InputManager.java:1153)
        at android.hardware.input.InputManager.injectInputEvent(InputManager.java:1182)
        ... 10 more

oguzokbalbesov avatar Feb 16 '24 14:02 oguzokbalbesov

@oguzokbalbesov This has nothing to do with this problem. Please read https://github.com/Genymobile/scrcpy#prerequisites

rom1v avatar Feb 16 '24 14:02 rom1v

Yes, it's explained in the section I linked:

On some devices, you also need to enable an additional option USB debugging (Security Settings) (this is an item different from USB debugging) to control it using a keyboard and mouse. Rebooting the device is necessary once this option is set.

rom1v avatar Feb 16 '24 16:02 rom1v

I don't know if this is related to the build from @rom1v but I thought I'd mention scrcpy froze once and I couldn't reconnect with scrcpy complaining that "ERROR: Could not find any ADB device" despite the fact that nmap showed the port was still open. After maybe a half hour of doing nothing (phone was in another room) it magically worked again so I don't know what that was all about.

ballo avatar Feb 19 '24 15:02 ballo

ERROR: Could not find any ADB device

What was the result of adb devices?

https://github.com/Genymobile/scrcpy/blob/master/FAQ.md#device-not-detected

rom1v avatar Feb 19 '24 15:02 rom1v

ERROR: Could not find any ADB device

What was the result of adb devices?

https://github.com/Genymobile/scrcpy/blob/master/FAQ.md#device-not-detected

If I could go back in time I'd tell ya. Let me know if there is anything else you'd like me to test if it happens again.

ballo avatar Feb 19 '24 16:02 ballo

Late to the party, but the modified scrcpy-server is working for me. I had just run a git pull when I saw it not work initially, so I guess that new file wasn't included.

icantremember avatar Feb 24 '24 01:02 icantremember

ERROR: Could not find any ADB device

What was the result of adb devices?

https://github.com/Genymobile/scrcpy/blob/master/FAQ.md#device-not-detected

So it's happening again and adb devices shows no devices. Port 5555 is open according to nmap

Edit: again, it cleared itself up eventually via some magic.

ballo avatar Feb 29 '24 21:02 ballo

我应该如何替换他

zanqi123 avatar Jul 22 '24 08:07 zanqi123