scrcpy: Doesn't work after upgrading to Android 14
Environment
- OS: Windows 10
- scrcpy version: 2.3
- installation method: Windows Build 64bit
- device model: samsung SM-S908B
- Android version: 14
Describe the bug
After upgrading my phone to Android 14 (from Android 13) scrcpy stopped working with the following error. I also tried no-audio and all available encoders. Before the upgrade, it worked just fine.
[server] INFO: Device: [samsung] samsung SM-S908B (Android 14)
[server] ERROR: Exception on thread Thread[video,5,main]
java.lang.AssertionError: java.lang.reflect.InvocationTargetException
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.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
at com.genymobile.scrcpy.wrappers.SurfaceControl.createDisplay(SurfaceControl.java:83)
... 6 more
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.res.Configuration android.app.ConfigurationController.getConfiguration()' on a null object reference
at android.app.ActivityThread.getConfiguration(ActivityThread.java:3899)
at android.hardware.display.DisplayManagerGlobal.getDisplayInfoLocked(DisplayManagerGlobal.java:260)
at android.hardware.display.DisplayManagerGlobal.getDisplayInfo(DisplayManagerGlobal.java:234)
at android.hardware.display.DisplayManagerGlobal.getCompatibleDisplay(DisplayManagerGlobal.java:364)
at android.hardware.display.DisplayManagerGlobal.getRealDisplay(DisplayManagerGlobal.java:397)
at android.hardware.display.DisplayManagerGlobal.createVirtualDisplayWrapper(DisplayManagerGlobal.java:779)
at android.hardware.display.DisplayManager.createVirtualDisplay(DisplayManager.java:2088)
at android.view.SurfaceControl.createDisplay(SurfaceControl.java:2480)
... 8 more
INFO: Renderer: direct3d
ERROR: Demuxer 'audio': stream disabled due to connection error
INFO: Texture: 1440x3088
WARN: Device disconnected
Also, if I do video-source camera, I get a different error as below. I do not know whether the two things are related. Before upgrading, I could not access all cameras (either not listed or instantly disconnecting without error message) but only two, now this error occurs all the time.
[server] INFO: Device: [samsung] samsung SM-S908B (Android 14)
[server] ERROR: Exception on thread Thread[video,5,main]
java.lang.AssertionError: java.lang.reflect.InvocationTargetException
at com.genymobile.scrcpy.wrappers.ServiceManager.getCameraManager(ServiceManager.java:146)
at com.genymobile.scrcpy.CameraCapture.selectCamera(CameraCapture.java:97)
at com.genymobile.scrcpy.CameraCapture.init(CameraCapture.java:75)
at com.genymobile.scrcpy.SurfaceEncoder.streamScreen(SurfaceEncoder.java:55)
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.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
at com.genymobile.scrcpy.wrappers.ServiceManager.getCameraManager(ServiceManager.java:144)
... 6 more
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'int android.content.Context.checkSelfPermission(java.lang.String)' on a null object reference
at android.content.ContextWrapper.checkSelfPermission(ContextWrapper.java:982)
at android.hardware.camera2.CameraManager.<init>(CameraManager.java:229)
... 9 more
INFO: Renderer: direct3d
ERROR: Demuxer 'video': stream disabled due to connection error
ERROR: Demuxer 'audio': stream disabled due to connection error
ERROR: Demuxer error
EDIT by @rom1v: fixed in scrcpy 2.3.1.
old
This will be fixed in the next version.Meanwhile, replace this file in the scrcpy 2.3 directory:
scrcpy-server
SHA-256: d3a1e798c490dd85e4bac19d5fb95b748f34f13c84676ddaa1f661ddb7ffc7e1
About this issue
- Original URL
- State: closed
- Created 7 months ago
- Reactions: 3
- Comments: 42
Did you also compile the server? (
install_release()
only installs the latest release)Instead, download
scrcpy-server
posted on the first post, and replace it in/usr/local/share/scrcpy/scrcpy-server
.@moe7863 No, the fix is in the first post of this thread.
This works for me for Device Share and Camera Share.
this one works for me with android 14
Getting the same problem on macOS, also with a Samsung phone on Android 14:
Some added code in the vendor ROM (samsung-specific code) which causes issue if
ActivityThread
is notnull
but the configuration controller isnull
(because thenthread.getConfiguration()
throws aNullPointerException
):Let’s try to set a fake configuration controller:
diff
Replace this binary into your scrcpy 2.3 directory:
scrcpy-server
SHA-256: 2ccffc7393767d15398742bfdecf2db642bb19ea837a76e31b2d0af8bf90b642