Skip to content
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

SCRCPY Broken for Android 14 QPR3 Beta #4656

Closed
2 tasks done
MemeCornucopia opened this issue Feb 9, 2024 · 21 comments
Closed
2 tasks done

SCRCPY Broken for Android 14 QPR3 Beta #4656

MemeCornucopia opened this issue Feb 9, 2024 · 21 comments

Comments

@MemeCornucopia
Copy link

MemeCornucopia commented Feb 9, 2024

  • I have read the FAQ.
  • 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
@dhwz
Copy link

dhwz commented Feb 9, 2024

[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

@rom1v
Copy link
Collaborator

rom1v commented Feb 9, 2024

Please post your framework.jar:

adb pull /system/framework/framework.jar

@dhwz
Copy link

dhwz commented Feb 9, 2024

framework.zip

@MemeCornucopia
Copy link
Author

MemeCornucopia commented Feb 9, 2024

@rom1v

frameworrk.jar

sorry for the late reply.

@dhwz
Copy link

dhwz commented Feb 9, 2024

I had already posted it above

@MemeCornucopia
Copy link
Author

I had already posted it above

Congrats! 🥳🎊

@rom1v
Copy link
Collaborator

rom1v commented Feb 9, 2024

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 pushed a commit that referenced this issue Feb 9, 2024
The method SurfaceControl.createDisplay() has been removed in AOSP.

Use DisplayManager to create a VirtualDisplay object instead.

Fixes #4646 <#4646>
Fixes #4656 <#4656>
PR #4657 <#4657>

Signed-off-by: Romain Vimont <rom@rom1v.com>
@rom1v
Copy link
Collaborator

rom1v commented Feb 9, 2024

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

@MemeCornucopia
Copy link
Author

@rom1v Can confirm it works

rom1v pushed a commit that referenced this issue Feb 9, 2024
The method SurfaceControl.createDisplay() has been removed in AOSP.

Use DisplayManager to create a VirtualDisplay object instead.

Fixes #4646 <#4646>
Fixes #4656 <#4656>
PR #4657 <#4657>

Signed-off-by: Romain Vimont <rom@rom1v.com>
@pier-da
Copy link

pier-da commented Feb 10, 2024

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

@ballo
Copy link

ballo commented Feb 11, 2024

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!

@vonDubenshire
Copy link

vonDubenshire commented Feb 11, 2024

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!

@oguzokbalbesov
Copy link

oguzokbalbesov commented Feb 16, 2024

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

@rom1v
Copy link
Collaborator

rom1v commented Feb 16, 2024

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

@rom1v
Copy link
Collaborator

rom1v commented Feb 16, 2024

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.

@ballo
Copy link

ballo commented Feb 19, 2024

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.

@rom1v
Copy link
Collaborator

rom1v commented Feb 19, 2024

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

@ballo
Copy link

ballo commented Feb 19, 2024

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.

@icantremember
Copy link

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.

@ballo
Copy link

ballo commented Feb 29, 2024

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.

armm29393 added a commit to armm29393/scrcpy-root that referenced this issue May 24, 2024
scrcpy v2.4

Changes since v2.3.1:
 - Add UHID keyboard and mouse support (Genymobile#4473)
 - Simulate tilt multitouch by pressing Shift (Genymobile#4529)
 - Add rotation support for non-default display (Genymobile#4698)
 - Improve audio player (Genymobile#4572)
 - Adapt to display API changes in Android 15 (Genymobile#4646, Genymobile#4656, Genymobile#4657)
 - Adapt audio workarounds to Android 14 (Genymobile#4492)
 - Fix clipboard for IQOO devices on Android 14 (Genymobile#4492, Genymobile#4589, Genymobile#4703)
 - Fix integer overflow for audio packet duration (Genymobile#4536)
 - Rework cleanup (Genymobile#4649)
 - Upgrade FFmpeg to 6.1.1 in Windows releases (Genymobile#4713)
 - Upgrade libusb to 1.0.27 in Windows releases (Genymobile#4713)
 - Various technical fixes
@zanqi123
Copy link

我应该如何替换他

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

No branches or pull requests

9 participants