scrcpy
scrcpy copied to clipboard
ERROR: Could not create display (virtual display)
Environment
- OS: Windows 11
- Scrcpy version: 3.0
- Installation method: Windows release
- Device model: Pixel 9 Pro XL
- Android version: 15 QPR2 Beta 1 (BP11.241025.006)
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
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)
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-apptoo)
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?
Here is a binary to replace in your v3.0 release folder.
scrcpy-serverSHA-256: b72f181bdcd939c2053517440eeac5e96ee43d73003c4e4d1508a5e31181977
Here is a binary to replace in your v3.0 release folder.
scrcpy-serverSHA-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
Same issue with my pixel 8 running Android 15 qpr2 beta1 and Fedora 41 laptop.
Same issue with my pixel 7 running Android 15 qpr2 beta1 and Windows 11
Can you run adb pull /system/priv-app/Shell/Shell.apk and upload the APK so we can check if the permission is really removed?
Can you run
adb pull /system/priv-app/Shell/Shell.apkand upload the APK so we can check if the permission is really removed?
here you go
@DuttaAB-dev Thanks
Sadly these three permissions are removed:
https://cs.android.com/android/platform/superproject/main/+/main:frameworks/base/packages/Shell/AndroidManifest.xml;l=749-752;drc=9840396a0d80a6fe8e0ad54e903d82eed8fd0f3e
Maybe for security, as I always think it's pretty dangerous to allow using virtual displays when the device is locked.
We need to remove these three flags:
https://github.com/Genymobile/scrcpy/blob/74aecc00b512969fa3b067ed3cf20e12194206d2/server/src/main/java/com/genymobile/scrcpy/video/NewDisplayCapture.java#L176-L178
We need to remove these three flags
I tested on Pixel 8, nothing works without these flags, even when the device is unlocked. For example, starting an app starts it on the main screen, not in the virtual display (which either is black or does not even appear).
Just got around to trying this and got the same result. Pixel 9 Fold, beta qpr2.
Same error Pixel 6 Android 15 qpr2 beta2 Requires ADD_TRUSTED_DISPLAY permission to create a trusted virtual display.
I have reported the issue here: https://issuetracker.google.com/issues/384752747
Having the same issue with Pixel 8 on Android 16 Developer Preview 2 and Fedora 41. Another device on Android 14 works with the computer.
We have reviewed this request and added the relevant permissions back to Shell for Android 16.
https://issuetracker.google.com/issues/384752747#comment8
@rom1v The issue still remains on the new Android 16 beta 2 :// ugh google. Also, another sidenote:
I''m currently running Android 16 as stated. But the info says Android 15. Attached a screenshot below:
Unfortunately the new March Pixel update released today seems to be causing this issue.
[server] INFO: Device: [Google] google Pixel 9 (Android 15) [server] ERROR: Could not create display java.lang.SecurityException: Requires ADD_TRUSTED_DISPLAY permission to create a trusted virtual display.
Is google really saying I have to wait for Android 16 for this to be resolved??
Ugh getting this same error now after the March Pixel update. Seems like we have to wait until A16 according to the issue tracker. How disappointing. Was using this daily on my work laptop to mirror my phone display.
Ugh getting this same error now after the March Pixel update. Seems like we have to wait until A16 according to the issue tracker. How disappointing. Was using this daily on my work laptop to mirror my phone display.
This thread is about an error using Virtual Display. If you're just mirroring and getting this exact error then I think there is (or just you have) a different problem.
Ugh getting this same error now after the March Pixel update. Seems like we have to wait until A16 according to the issue tracker. How disappointing. Was using this daily on my work laptop to mirror my phone display.
This thread is about an error using Virtual Display. If you're just mirroring and getting this exact error then I think there is (or just you have) a different problem.
You're right, I was using the term "mirror" interchangeably. I am getting this error specifically using virtual display. Thanks for pointing that out.
It finally works on Andorid 16 beta 3! 🚀
Great :+1:
However, I see an audio capture issue in your logs in the screenshot? Is that new?
Great 👍
However, I see an audio capture issue in your logs in the screenshot? Is that new?
Yep, that seems to be new.. Do you want me to share the logs?
^ #5960
The audio issue is already fixed by #5698.
same bug on lineage os 22.2(oneplus 7T) 😂
scrcpy 3.2 <https://github.com/Genymobile/scrcpy>
INFO: ADB device found:
INFO: --> (usb) db411807 device HD1901
/usr/local/share/scrcpy/scrcpy-server: 1 file pushed, 0 skipped. 223.1 MB/s (90888 bytes in 0.000s)
[server] INFO: Device: [OnePlus] OnePlus HD1901 (Android 15)
INFO: USB device found:
INFO: --> db411807 (22d9:2769) OnePlus HD1901
INFO: USB device: db411807 (22d9:2769) OnePlus HD1901
INFO: Renderer: opengl
INFO: OpenGL version: 4.6 (Compatibility Profile) Mesa 24.2.8-1ubuntu1~24.04.1
INFO: Trilinear filtering enabled
INFO: Texture: 1920x1080
[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:3261)
at android.os.Parcel.createException(Parcel.java:3245)
at android.os.Parcel.readException(Parcel.java:3228)
at android.os.Parcel.readException(Parcel.java:3170)
at android.hardware.display.IDisplayManager$Stub$Proxy.createVirtualDisplay(IDisplayManager.java:1603)
at android.hardware.display.DisplayManagerGlobal.createVirtualDisplay(DisplayManagerGlobal.java:824)
at android.hardware.display.DisplayManager.createVirtualDisplay(DisplayManager.java:1261)
at android.hardware.display.DisplayManager.createVirtualDisplay(DisplayManager.java:1221)
at android.hardware.display.DisplayManager.createVirtualDisplay(DisplayManager.java:1169)
at android.hardware.display.DisplayManager.createVirtualDisplay(DisplayManager.java:1108)
at com.genymobile.scrcpy.wrappers.DisplayManager.createNewVirtualDisplay(DisplayManager.java:164)
at com.genymobile.scrcpy.video.NewDisplayCapture.startNew(NewDisplayCapture.java:192)
at com.genymobile.scrcpy.video.NewDisplayCapture.start(NewDisplayCapture.java:217)
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:296)
at com.genymobile.scrcpy.video.SurfaceEncoder$$ExternalSyntheticLambda0.run(D8$$SyntheticClass:0)
at java.lang.Thread.run(Thread.java:1119)
Caused by: android.os.RemoteException: Remote stack trace:
at com.android.server.display.DisplayManagerService.createVirtualDisplayInternal(DisplayManagerService.java:1889)
at com.android.server.display.DisplayManagerService.-$$Nest$mcreateVirtualDisplayInternal(DisplayManagerService.java:0)
at com.android.server.display.DisplayManagerService$BinderService.createVirtualDisplay(DisplayManagerService.java:4760)
at android.hardware.display.IDisplayManager$Stub.onTransact(IDisplayManager.java:819)
at android.os.Binder.execTransactInternal(Binder.java:1406)
WARN: Device disconnected
[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:203)
at com.genymobile.scrcpy.video.NewDisplayCapture.start(NewDisplayCapture.java:217)
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:296)
at com.genymobile.scrcpy.video.SurfaceEncoder$$ExternalSyntheticLambda0.run(D8$$SyntheticClass:0)
at java.lang.Thread.run(Thread.java:1119)
[server] INFO: Device display turned off
Sorry if it is an inappropriate/trivial remark, but note that if use Rooted debugging
adb root
restarting adbd as root
then:
scrcpy --new-display
Output:
scrcpy 3.2 <https://github.com/Genymobile/scrcpy>
INFO: ADB device found:
INFO: --> (usb) XXXXXXXX device FP4
/usr/local/share/scrcpy/scrcpy-server: 1 file pushed, 0 skipped. 69.5 MB/s (90888 bytes in 0.001s)
[server] INFO: Device: [Fairphone] Fairphone FP4 (Android 15)
INFO: Renderer: opengl
INFO: OpenGL version: 4.6 (Compatibility Profile) Mesa 24.2.8-1ubuntu1~24.04.1
INFO: Trilinear filtering enabled
INFO: Texture: 1080x2336
[server] INFO: New display: 1080x2340/440 (id=3)
works fine on Fairphone 4 LineageOS 22.2.
Output without adb root:
/usr/local/share/scrcpy/scrcpy-server: 1 file pushed, 0 skipped. 189.2 MB/s (90888 bytes in 0.000s)
[server] INFO: Device: [Fairphone] Fairphone FP4 (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:3261)
at android.os.Parcel.createException(Parcel.java:3245)
at android.os.Parcel.readException(Parcel.java:3228)
at android.os.Parcel.readException(Parcel.java:3170)
at android.hardware.display.IDisplayManager$Stub$Proxy.createVirtualDisplay(IDisplayManager.java:1603)
at android.hardware.display.DisplayManagerGlobal.createVirtualDisplay(DisplayManagerGlobal.java:824)
at android.hardware.display.DisplayManager.createVirtualDisplay(DisplayManager.java:1261)
at android.hardware.display.DisplayManager.createVirtualDisplay(DisplayManager.java:1221)
at android.hardware.display.DisplayManager.createVirtualDisplay(DisplayManager.java:1169)
at android.hardware.display.DisplayManager.createVirtualDisplay(DisplayManager.java:1108)
at com.genymobile.scrcpy.wrappers.DisplayManager.createNewVirtualDisplay(DisplayManager.java:164)
at com.genymobile.scrcpy.video.NewDisplayCapture.startNew(NewDisplayCapture.java:192)
at com.genymobile.scrcpy.video.NewDisplayCapture.start(NewDisplayCapture.java:217)
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:296)
at com.genymobile.scrcpy.video.SurfaceEncoder$$ExternalSyntheticLambda0.run(D8$$SyntheticClass:0)
at java.lang.Thread.run(Thread.java:1119)
Caused by: android.os.RemoteException: Remote stack trace:
at com.android.server.display.DisplayManagerService.createVirtualDisplayInternal(DisplayManagerService.java:1889)
at com.android.server.display.DisplayManagerService.-$$Nest$mcreateVirtualDisplayInternal(DisplayManagerService.java:0)
at com.android.server.display.DisplayManagerService$BinderService.createVirtualDisplay(DisplayManagerService.java:4760)
at android.hardware.display.IDisplayManager$Stub.onTransact(IDisplayManager.java:819)
at android.os.Binder.execTransactInternal(Binder.java:1406)
WARN: Device disconnected
[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:203)
at com.genymobile.scrcpy.video.NewDisplayCapture.start(NewDisplayCapture.java:217)
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:296)
at com.genymobile.scrcpy.video.SurfaceEncoder$$ExternalSyntheticLambda0.run(D8$$SyntheticClass:0)
at java.lang.Thread.run(Thread.java:1119)
scrcpy 3.2 <https://github.com/Genymobile/scrcpy>
INFO: ADB device found:
INFO: --> (usb) XXXXXXXX device FP4
INFO: Renderer: opengl
INFO: OpenGL version: 4.6 (Compatibility Profile) Mesa 24.2.8-1ubuntu1~24.04.1
INFO: Trilinear filtering enabled
INFO: Texture: 1080x2336
on Linux Mint 22.1 Cinnamon Framework 13.
BTW I merged this — https://review.lineageos.org/c/LineageOS/android_frameworks_base/+/430456
BTW I merged this — https://review.lineageos.org/c/LineageOS/android_frameworks_base/+/430456
I am now running lineage-22.2-20250514-nightly-FP4-signed.zip on my Fairphone 4 LineageOS 22.2 and I confirm that I do not need to adb root anymore to scrcpy --new-display, the patch Add the VDM permissions to shell being mentioned in changelogs. Thank you @luk1337.
i fixed by typing adb root