Genymobile / scrcpy

Display and control your Android device
Apache License 2.0
112.71k stars 10.77k forks source link

ERROR: Could not create display #5523

Open Frogperson opened 1 day ago

Frogperson commented 1 day ago

Environment

Describe the bug

Running scrcpy --new-display results in the following error:

[server] INFO: Device: [Google] google Pixel 9 Pro XL (Android 15)
[server] ERROR: Could not create display
java.lang.SecurityException: Requires ADD_TRUSTED_DISPLAY permission to create a trusted virtual display.
        at android.os.Parcel.createExceptionOrNull(Parcel.java:3231)
        at android.os.Parcel.createException(Parcel.java:3215)
        at android.os.Parcel.readException(Parcel.java:3198)
        at android.os.Parcel.readException(Parcel.java:3140)
        at android.hardware.display.IDisplayManager$Stub$Proxy.createVirtualDisplay(IDisplayManager.java:1570)
        at android.hardware.display.DisplayManagerGlobal.createVirtualDisplay(DisplayManagerGlobal.java:757)
        at android.hardware.display.DisplayManager.createVirtualDisplay(DisplayManager.java:1186)
        at android.hardware.display.DisplayManager.createVirtualDisplay(DisplayManager.java:1146)
        at android.hardware.display.DisplayManager.createVirtualDisplay(DisplayManager.java:1094)
        at android.hardware.display.DisplayManager.createVirtualDisplay(DisplayManager.java:1033)
        at com.genymobile.scrcpy.wrappers.DisplayManager.createNewVirtualDisplay(DisplayManager.java:164)
        at com.genymobile.scrcpy.video.NewDisplayCapture.startNew(NewDisplayCapture.java:186)
        at com.genymobile.scrcpy.video.NewDisplayCapture.start(NewDisplayCapture.java:207)
        at com.genymobile.scrcpy.video.SurfaceEncoder.streamCapture(SurfaceEncoder.java:95)
        at com.genymobile.scrcpy.video.SurfaceEncoder.lambda$start$0$com-genymobile-scrcpy-video-SurfaceEncoder(SurfaceEncoder.java:292)
        at com.genymobile.scrcpy.video.SurfaceEncoder$$ExternalSyntheticLambda0.run(D8$$SyntheticClass:0)
        at java.lang.Thread.run(Thread.java:1012)
Caused by: android.os.RemoteException: Remote stack trace:
        at com.android.server.display.DisplayManagerService.createVirtualDisplayInternal(DisplayManagerService.java:1836)
        at com.android.server.display.DisplayManagerService.-$$Nest$mcreateVirtualDisplayInternal(DisplayManagerService.java:0)
        at com.android.server.display.DisplayManagerService$BinderService.createVirtualDisplay(DisplayManagerService.java:4593)
        at android.hardware.display.IDisplayManager$Stub.onTransact(IDisplayManager.java:802)
        at android.os.Binder.execTransactInternal(Binder.java:1406)

[server] ERROR: Exception on thread Thread[video,5,main]
java.lang.AssertionError: Could not create display
        at com.genymobile.scrcpy.video.NewDisplayCapture.startNew(NewDisplayCapture.java:193)
        at com.genymobile.scrcpy.video.NewDisplayCapture.start(NewDisplayCapture.java:207)
        at com.genymobile.scrcpy.video.SurfaceEncoder.streamCapture(SurfaceEncoder.java:95)
        at com.genymobile.scrcpy.video.SurfaceEncoder.lambda$start$0$com-genymobile-scrcpy-video-SurfaceEncoder(SurfaceEncoder.java:292)
        at com.genymobile.scrcpy.video.SurfaceEncoder$$ExternalSyntheticLambda0.run(D8$$SyntheticClass:0)
        at java.lang.Thread.run(Thread.java:1012)
INFO: Renderer: direct3d
WARN: Device disconnected
ERROR: Demuxer 'audio': stream disabled due to connection error
rom1v commented 1 day ago

Could you please try removing this flag and rebuild:

https://github.com/Genymobile/scrcpy/blob/74aecc00b512969fa3b067ed3cf20e12194206d2/server/src/main/java/com/genymobile/scrcpy/video/NewDisplayCapture.java#L176

(you probably will have to start an app with --start-app too)

Frogperson commented 1 day ago

Could you please try removing this flag and rebuild:

https://github.com/Genymobile/scrcpy/blob/74aecc00b512969fa3b067ed3cf20e12194206d2/server/src/main/java/com/genymobile/scrcpy/video/NewDisplayCapture.java#L176

(you probably will have to start an app with --start-app too)

I'm happy to test this, but I don't have a build environment set up. Would you be able to build it for me?

rom1v commented 3 hours ago

Here is a binary to replace in your v3.0 release folder.

Frogperson commented 3 hours ago

Here is a binary to replace in your v3.0 release folder.

  • scrcpy-server SHA-256: b72f181bdcd939c2053517440eeac5e96ee43d73003c4e4d1508a5e31181977

Thank you! Unfortunately, it still doesn't work. Similar but slightly different error this time: diff: https://www.diffchecker.com/oDwjavgj/

[server] INFO: Device: [Google] google Pixel 9 Pro XL (Android 15)
[server] ERROR: Could not create display
java.lang.SecurityException: Requires ADD_TRUSTED_DISPLAY permission to create a virtual display which is not in the default DisplayGroup.
        at android.os.Parcel.createExceptionOrNull(Parcel.java:3231)
        at android.os.Parcel.createException(Parcel.java:3215)
        at android.os.Parcel.readException(Parcel.java:3198)
        at android.os.Parcel.readException(Parcel.java:3140)
        at android.hardware.display.IDisplayManager$Stub$Proxy.createVirtualDisplay(IDisplayManager.java:1570)
        at android.hardware.display.DisplayManagerGlobal.createVirtualDisplay(DisplayManagerGlobal.java:757)
        at android.hardware.display.DisplayManager.createVirtualDisplay(DisplayManager.java:1186)
        at android.hardware.display.DisplayManager.createVirtualDisplay(DisplayManager.java:1146)
        at android.hardware.display.DisplayManager.createVirtualDisplay(DisplayManager.java:1094)
        at android.hardware.display.DisplayManager.createVirtualDisplay(DisplayManager.java:1033)
        at com.genymobile.scrcpy.wrappers.DisplayManager.createNewVirtualDisplay(DisplayManager.java:164)
        at com.genymobile.scrcpy.video.NewDisplayCapture.startNew(NewDisplayCapture.java:185)
        at com.genymobile.scrcpy.video.NewDisplayCapture.start(NewDisplayCapture.java:206)
        at com.genymobile.scrcpy.video.SurfaceEncoder.streamCapture(SurfaceEncoder.java:95)
        at com.genymobile.scrcpy.video.SurfaceEncoder.lambda$start$0$com-genymobile-scrcpy-video-SurfaceEncoder(SurfaceEncoder.java:292)
        at com.genymobile.scrcpy.video.SurfaceEncoder$$ExternalSyntheticLambda0.run(D8$$SyntheticClass:0)
        at java.lang.Thread.run(Thread.java:1012)
Caused by: android.os.RemoteException: Remote stack trace:
        at com.android.server.display.DisplayManagerService.createVirtualDisplayInternal(DisplayManagerService.java:1853)
        at com.android.server.display.DisplayManagerService.-$$Nest$mcreateVirtualDisplayInternal(DisplayManagerService.java:0)
        at com.android.server.display.DisplayManagerService$BinderService.createVirtualDisplay(DisplayManagerService.java:4593)
        at android.hardware.display.IDisplayManager$Stub.onTransact(IDisplayManager.java:802)
        at android.os.Binder.execTransactInternal(Binder.java:1406)

[server] ERROR: Exception on thread Thread[video,5,main]
java.lang.AssertionError: Could not create display
        at com.genymobile.scrcpy.video.NewDisplayCapture.startNew(NewDisplayCapture.java:192)
        at com.genymobile.scrcpy.video.NewDisplayCapture.start(NewDisplayCapture.java:206)
        at com.genymobile.scrcpy.video.SurfaceEncoder.streamCapture(SurfaceEncoder.java:95)
        at com.genymobile.scrcpy.video.SurfaceEncoder.lambda$start$0$com-genymobile-scrcpy-video-SurfaceEncoder(SurfaceEncoder.java:292)
        at com.genymobile.scrcpy.video.SurfaceEncoder$$ExternalSyntheticLambda0.run(D8$$SyntheticClass:0)
        at java.lang.Thread.run(Thread.java:1012)
INFO: Renderer: direct3d
WARN: Device disconnected
ERROR: Demuxer 'audio': stream disabled due to connection error