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

Doesn't work after upgrading to Android 14 #4467

Closed
2 tasks done
benn02 opened this issue Nov 26, 2023 · 42 comments
Closed
2 tasks done

Doesn't work after upgrading to Android 14 #4467

benn02 opened this issue Nov 26, 2023 · 42 comments

Comments

@benn02
Copy link

benn02 commented Nov 26, 2023

  • I have read the FAQ.
  • I have searched in existing issues.

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
@rom1v
Copy link
Collaborator

rom1v commented Nov 26, 2023

scrcpy version: 2.3

Are you sure? These problems in scrcpy 2.2 have been fixed in 2.3.

@benn02
Copy link
Author

benn02 commented Nov 26, 2023

I downloaded the scrcpy-win64-v2.3.zip from GitHub and my --version is this:

scrcpy  --version
scrcpy 2.3 <https://github.com/Genymobile/scrcpy>

Dependencies (compiled / linked):
 - SDL: 2.28.5 / 2.28.5
 - libavcodec: 60.31.102 / 60.31.102
 - libavformat: 60.16.100 / 60.16.100
 - libavutil: 58.29.100 / 58.29.100
 - libusb: - / 1.0.26

@rom1v
Copy link
Collaborator

rom1v commented Nov 26, 2023

Could you please try v2.2? What aee the error messages in the output? (are there tthe same?)

@benn02
Copy link
Author

benn02 commented Nov 26, 2023

When using Version 2.2 the normal screen share, audio share and using the pc to klick on the phone works just fine. However I still cannot access the camera:

scrcpy --video-source=camera --camera-id=1
scrcpy v2.2 <https://github.com/Genymobile/scrcpy>
INFO: Camera video source: control disabled
INFO: Camera video source: microphone audio source selected
INFO: ADB device found:
INFO:     -->   (usb)           *HIDDEN*   device  SM_S908B
*HIDDEN*\scrcpy-win64-v2.2\scrcpy-server: 1 file pushed, 0 skipped. 112.8 MB/s (64363 bytes in 0.001s)
[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:145)
        at com.genymobile.scrcpy.CameraCapture.selectSize(CameraCapture.java:125)
        at com.genymobile.scrcpy.CameraCapture.init(CameraCapture.java:80)
        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:143)
        ... 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

@rom1v
Copy link
Collaborator

rom1v commented Nov 26, 2023

Thank you.

Please post your framework.jar:

adb pull /system/framework/framework.jar

@benn02
Copy link
Author

benn02 commented Nov 26, 2023

framework.zip

@rom1v
Copy link
Collaborator

rom1v commented Nov 26, 2023

Some added code in the vendor ROM (samsung-specific code) which causes issue if ActivityThread is not null but the configuration controller is null (because then thread.getConfiguration() throws a NullPointerException):

        if (CoreRune.MT_SUPPORT_COMPAT_SANDBOX) {
            ActivityThread thread = ActivityThread.currentActivityThread();
            Configuration currentConfig = thread != null ? thread.getConfiguration() : null;
            if (CompatSandbox.isDisplaySandboxingEnabled(currentConfig)) {

Let's try to set a fake configuration controller:

diff
diff --git a/server/src/main/java/com/genymobile/scrcpy/Workarounds.java b/server/src/main/java/com/genymobile/scrcpy/Workarounds.java
index db9c96290..47c09b84e 100644
--- a/server/src/main/java/com/genymobile/scrcpy/Workarounds.java
+++ b/server/src/main/java/com/genymobile/scrcpy/Workarounds.java
@@ -91,6 +91,8 @@ public final class Workarounds {
         if (mustFillAppContext) {
             Workarounds.fillAppContext();
         }
+
+        fillConfigurationController();
     }
 
     @SuppressWarnings("deprecation")
@@ -149,6 +151,22 @@ public final class Workarounds {
         }
     }
 
+    private static void fillConfigurationController() {
+        try {
+            Class<?> configurationControllerClass = Class.forName("android.app.ConfigurationController");
+            Class<?> activityThreadInternalClass = Class.forName("android.app.ActivityThreadInternal");
+            Constructor<?> configurationControllerConstructor = configurationControllerClass.getDeclaredConstructor(activityThreadInternalClass);
+            configurationControllerConstructor.setAccessible(true);
+            Object configurationController = configurationControllerConstructor.newInstance(ACTIVITY_THREAD);
+
+            Field configurationControllerField = ACTIVITY_THREAD_CLASS.getDeclaredField("mConfigurationController");
+            configurationControllerField.setAccessible(true);
+            configurationControllerField.set(ACTIVITY_THREAD, configurationController);
+        } catch (Throwable throwable) {
+            Ln.d("Could not fill configuration: " + throwable.getMessage());
+        }
+    }
+
     static Context getSystemContext() {
         try {
             Method getSystemContextMethod = ACTIVITY_THREAD_CLASS.getDeclaredMethod("getSystemContext");

Replace this binary into your scrcpy 2.3 directory:

  • scrcpy-server SHA-256: 2ccffc7393767d15398742bfdecf2db642bb19ea837a76e31b2d0af8bf90b642

@benn02
Copy link
Author

benn02 commented Nov 26, 2023

I get a 404 when trying to download the binary.

@rom1v
Copy link
Collaborator

rom1v commented Nov 26, 2023

Oops, link fixed.

@benn02
Copy link
Author

benn02 commented Nov 26, 2023

This works for the normal screen share mode, but the camera share still seems to be broken. Should I open another issue for this, since the main thing is solved?

@benn02
Copy link
Author

benn02 commented Nov 26, 2023

The error message for the camera is the same as in the original issue.

@rom1v
Copy link
Collaborator

rom1v commented Nov 26, 2023

I can't explain why you get a null context here. But maybe this will be sufficient:

diff
diff --git a/server/src/main/java/com/genymobile/scrcpy/FakeContext.java b/server/src/main/java/com/genymobile/scrcpy/FakeContext.java
index 2ea7bf4af..fd3a3411a 100644
--- a/server/src/main/java/com/genymobile/scrcpy/FakeContext.java
+++ b/server/src/main/java/com/genymobile/scrcpy/FakeContext.java
@@ -4,6 +4,7 @@ import android.annotation.TargetApi;
 import android.content.AttributionSource;
 import android.content.Context;
 import android.content.ContextWrapper;
+import android.content.pm.PackageManager;
 import android.os.Build;
 import android.os.Process;
 
@@ -50,4 +51,9 @@ public final class FakeContext extends ContextWrapper {
     public Context getApplicationContext() {
         return this;
     }
+
+    @Override
+    public int checkSelfPermission(String permission) {
+        return PackageManager.PERMISSION_GRANTED;
+    }
 }

Replace this binary into your scrcpy 2.3 directory:

  • scrcpy-server SHA-256: f298a5e4419206a714aab0bd6dbd6ffaff1760dac39eee6336e2215ccb2180d8

@benn02
Copy link
Author

benn02 commented Nov 26, 2023

Unfortunately, I still get this error:

scrcpy --video-source=camera --camera-id=1
[server] INFO: Device: [samsung] samsung SM-S908B (Android 14)
[server] ERROR: Exception on thread Thread[video,5,main]
java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.pm.PackageManager android.content.Context.getPackageManager()' on a null object reference
        at android.content.ContextWrapper.getPackageManager(ContextWrapper.java:134)
        at android.hardware.camera2.CameraManager.shouldOverrideToPortrait(CameraManager.java:1505)
        at android.hardware.camera2.CameraManager.getCameraCharacteristics(CameraManager.java:781)
        at com.genymobile.scrcpy.CameraCapture.selectSize(CameraCapture.java:126)
        at com.genymobile.scrcpy.CameraCapture.init(CameraCapture.java:80)
        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)
INFO: Renderer: direct3d
ERROR: Demuxer 'video': stream disabled due to connection error
ERROR: Demuxer 'audio': stream disabled due to connection error
ERROR: Demuxer error

@rom1v
Copy link
Collaborator

rom1v commented Nov 26, 2023

OK, let's add some logs:

diff
diff --git a/server/src/main/java/com/genymobile/scrcpy/Workarounds.java b/server/src/main/java/com/genymobile/scrcpy/Workarounds.java
index db9c96290..14361c6dd 100644
--- a/server/src/main/java/com/genymobile/scrcpy/Workarounds.java
+++ b/server/src/main/java/com/genymobile/scrcpy/Workarounds.java
@@ -152,10 +152,12 @@ public final class Workarounds {
     static Context getSystemContext() {
         try {
             Method getSystemContextMethod = ACTIVITY_THREAD_CLASS.getDeclaredMethod("getSystemContext");
-            return (Context) getSystemContextMethod.invoke(ACTIVITY_THREAD);
+            Context context = (Context) getSystemContextMethod.invoke(ACTIVITY_THREAD);
+            Ln.i("=== " + context);
+            return context;
         } catch (Throwable throwable) {
             // this is a workaround, so failing is not an error
-            Ln.d("Could not get system context: " + throwable.getMessage());
+            Ln.e("Could not get system context: ", throwable);
             return null;
         }
     }

Replace this binary into your scrcpy 2.3 directory:

  • scrcpy-server SHA-256: e633d1e6cc5d044456c66c048e73e25d93ec5c61c11b9d9c4effc4f027c2a45d

Please post the full console output when you mirror the device and when you mirror the camera (both will fail, but I want the output).

@benn02
Copy link
Author

benn02 commented Nov 26, 2023

scrcpy
scrcpy 2.3 <https://github.com/Genymobile/scrcpy>
INFO: ADB device found:
INFO:     -->   (usb)           *HIDDEN*  device  SM_S908B
*HIDDEN*\scrcpy-win64-v2.3\scrcpy-server: 1 file pushed, 0 skipped. 103.8 MB/s (155853 bytes in 0.001s)
[server] INFO: Device: [samsung] samsung SM-S908B (Android 14)
[server] ERROR: Could not get system context:
java.lang.reflect.InvocationTargetException
        at java.lang.reflect.Method.invoke(Native Method)
        at com.genymobile.scrcpy.Workarounds.getSystemContext(Workarounds.java:155)
        at com.genymobile.scrcpy.FakeContext.<init>(FakeContext.java:22)
        at com.genymobile.scrcpy.FakeContext.<clinit>(FakeContext.java:15)
        at com.genymobile.scrcpy.AudioCapture.createAudioRecord(AudioCapture.java:61)
        at com.genymobile.scrcpy.AudioCapture.startRecording(AudioCapture.java:111)
        at com.genymobile.scrcpy.AudioCapture.start(AudioCapture.java:130)
        at com.genymobile.scrcpy.AudioEncoder.encode(AudioEncoder.java:190)
        at com.genymobile.scrcpy.AudioEncoder.lambda$start$0$com-genymobile-scrcpy-AudioEncoder(AudioEncoder.java:121)
        at com.genymobile.scrcpy.AudioEncoder$$ExternalSyntheticLambda0.run(Unknown Source:4)
        at java.lang.Thread.run(Thread.java:1012)
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.app.ResourcesManager.getDisplayMetrics(ResourcesManager.java:360)
        at android.app.ResourcesManager.getDisplayMetrics(ResourcesManager.java:349)
        at android.app.ContextImpl.createSystemContext(ContextImpl.java:3454)
        at android.app.ActivityThread.getSystemContext(ActivityThread.java:3209)
        ... 11 more
[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


scrcpy --video-source=camera --camera-id=1
scrcpy 2.3 <https://github.com/Genymobile/scrcpy>
INFO: Camera video source: control disabled
INFO: Camera video source: microphone audio source selected
INFO: ADB device found:
INFO:     -->   (usb)           *HIDDEN*  device  SM_S908B
*HIDDEN*\scrcpy-win64-v2.3\scrcpy-server: 1 file pushed, 0 skipped. 103.8 MB/s (155853 bytes in 0.001s)
[server] INFO: Device: [samsung] samsung SM-S908B (Android 14)
[server] ERROR: Could not get system context:
java.lang.reflect.InvocationTargetException
        at java.lang.reflect.Method.invoke(Native Method)
        at com.genymobile.scrcpy.Workarounds.getSystemContext(Workarounds.java:155)
        at com.genymobile.scrcpy.FakeContext.<init>(FakeContext.java:22)
        at com.genymobile.scrcpy.FakeContext.<clinit>(FakeContext.java:15)
        at com.genymobile.scrcpy.Workarounds.fillAppContext(Workarounds.java:140)
        at com.genymobile.scrcpy.Workarounds.apply(Workarounds.java:92)
        at com.genymobile.scrcpy.Server.scrcpy(Server.java:116)
        at com.genymobile.scrcpy.Server.internalMain(Server.java:244)
        at com.genymobile.scrcpy.Server.main(Server.java:199)
        at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
        at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:415)
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.app.ResourcesManager.getDisplayMetrics(ResourcesManager.java:360)
        at android.app.ResourcesManager.getDisplayMetrics(ResourcesManager.java:349)
        at android.app.ContextImpl.createSystemContext(ContextImpl.java:3454)
        at android.app.ActivityThread.getSystemContext(ActivityThread.java:3209)
        ... 11 more
[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.selectSize(CameraCapture.java:125)
        at com.genymobile.scrcpy.CameraCapture.init(CameraCapture.java:80)
        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

@rom1v
Copy link
Collaborator

rom1v commented Nov 26, 2023

Thank you. One more time with this one please (for both device and camera mirroring):

diff
diff --git a/server/src/main/java/com/genymobile/scrcpy/Workarounds.java b/server/src/main/java/com/genymobile/scrcpy/Workarounds.java
index db9c96290..1006d73c2 100644
--- a/server/src/main/java/com/genymobile/scrcpy/Workarounds.java
+++ b/server/src/main/java/com/genymobile/scrcpy/Workarounds.java
@@ -91,6 +91,8 @@ public final class Workarounds {
         if (mustFillAppContext) {
             Workarounds.fillAppContext();
         }
+
+        fillConfigurationController();
     }
 
     @SuppressWarnings("deprecation")
@@ -149,13 +151,31 @@ public final class Workarounds {
         }
     }
 
+    private static void fillConfigurationController() {
+        try {
+            Class<?> configurationControllerClass = Class.forName("android.app.ConfigurationController");
+            Class<?> activityThreadInternalClass = Class.forName("android.app.ActivityThreadInternal");
+            Constructor<?> configurationControllerConstructor = configurationControllerClass.getDeclaredConstructor(activityThreadInternalClass);
+            configurationControllerConstructor.setAccessible(true);
+            Object configurationController = configurationControllerConstructor.newInstance(ACTIVITY_THREAD);
+
+            Field configurationControllerField = ACTIVITY_THREAD_CLASS.getDeclaredField("mConfigurationController");
+            configurationControllerField.setAccessible(true);
+            configurationControllerField.set(ACTIVITY_THREAD, configurationController);
+        } catch (Throwable throwable) {
+            Ln.d("Could not fill configuration: " + throwable.getMessage());
+        }
+    }
+
     static Context getSystemContext() {
         try {
             Method getSystemContextMethod = ACTIVITY_THREAD_CLASS.getDeclaredMethod("getSystemContext");
-            return (Context) getSystemContextMethod.invoke(ACTIVITY_THREAD);
+            Context context = (Context) getSystemContextMethod.invoke(ACTIVITY_THREAD);
+            Ln.i("=== " + context);
+            return context;
         } catch (Throwable throwable) {
             // this is a workaround, so failing is not an error
-            Ln.d("Could not get system context: " + throwable.getMessage());
+            Ln.e("Could not get system context: ", throwable);
             return null;
         }
     }
  • scrcpy-server SHA-256: 6be1466fc1048b5e055431e6cc7f5be2e5f6e6c5c1a749802ce5d3d3ad11a58e

@benn02
Copy link
Author

benn02 commented Nov 26, 2023

It seems like the device sharing works and the camera still has the same error as in my last comment:

[server] INFO: Device: [samsung] samsung SM-S908B (Android 14)
[server] ERROR: Could not get system context:
java.lang.reflect.InvocationTargetException
        at java.lang.reflect.Method.invoke(Native Method)
        at com.genymobile.scrcpy.Workarounds.getSystemContext(Workarounds.java:173)
        at com.genymobile.scrcpy.FakeContext.<init>(FakeContext.java:22)
        at com.genymobile.scrcpy.FakeContext.<clinit>(FakeContext.java:15)
        at com.genymobile.scrcpy.Workarounds.fillAppContext(Workarounds.java:142)
        at com.genymobile.scrcpy.Workarounds.apply(Workarounds.java:92)
        at com.genymobile.scrcpy.Server.scrcpy(Server.java:116)
        at com.genymobile.scrcpy.Server.internalMain(Server.java:244)
        at com.genymobile.scrcpy.Server.main(Server.java:199)
        at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
        at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:415)
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.app.ResourcesManager.getDisplayMetrics(ResourcesManager.java:360)
        at android.app.ResourcesManager.getDisplayMetrics(ResourcesManager.java:349)
        at android.app.ContextImpl.createSystemContext(ContextImpl.java:3454)
        at android.app.ActivityThread.getSystemContext(ActivityThread.java:3209)
        ... 11 more
[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.selectSize(CameraCapture.java:125)
        at com.genymobile.scrcpy.CameraCapture.init(CameraCapture.java:80)
        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

@rom1v
Copy link
Collaborator

rom1v commented Nov 26, 2023

Oh ok thank you, I understand. I will propose a new binary to test tomorrow probably.

@benn02
Copy link
Author

benn02 commented Nov 26, 2023

OK, thank you for your help so far.

@SamLeatherdale
Copy link

Getting the same problem on macOS, also with a Samsung phone on Android 14:

scrcpy --no-audio -d
scrcpy 2.3 <https://github.com/Genymobile/scrcpy>
INFO: ADB device found:
INFO:     -->   (usb)  RFCW10T3PCB                     device  SM_S911B
/opt/homebrew/Cellar/scrcpy/2.3/share/scrcpy/scrcpy-server: 1 file pushed, 0 skipped. 98.4 MB/s (65851 bytes in 0.001s)
[server] INFO: Device: [samsung] samsung SM-S911B (Android 14)
[server] ERROR: Exception on thread Thread[binder:475_1,5,main]
java.lang.AssertionError: java.lang.reflect.InvocationTargetException
	at com.genymobile.scrcpy.wrappers.DisplayManager.getDisplayInfo(DisplayManager.java:86)
	at com.genymobile.scrcpy.Device$2.onDisplayFoldChanged(Device.java:113)
	at android.view.IDisplayFoldListener$Stub.onTransact(IDisplayFoldListener.java:90)
	at android.os.Binder.execTransactInternal(Binder.java:1380)
	at android.os.Binder.execTransact(Binder.java:1311)
Caused by: java.lang.reflect.InvocationTargetException
	at java.lang.reflect.Method.invoke(Native Method)
	at com.genymobile.scrcpy.wrappers.DisplayManager.getDisplayInfo(DisplayManager.java:72)
	... 4 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)
	... 6 more
[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: metal
INFO: Texture: 1080x2336
WARN: Device disconnected

rom1v added a commit that referenced this issue Nov 27, 2023
On some Samsung devices, DisplayManagerGlobal.getDisplayInfoLocked()
calls ActivityThread.currentActivityThread().getConfiguration(), which
requires a non-null ConfigurationController.

Fixes <#4467>
@rom1v
Copy link
Collaborator

rom1v commented Nov 27, 2023

I think 140a49b can fix it.

Please test:

  • scrcpy-server SHA-256: d3a1e798c490dd85e4bac19d5fb95b748f34f13c84676ddaa1f661ddb7ffc7e1

@gbil
Copy link

gbil commented Nov 27, 2023

I think 140a49b can fix it.

Please test:

  • scrcpy-server SHA-256: d3a1e798c490dd85e4bac19d5fb95b748f34f13c84676ddaa1f661ddb7ffc7e1

this one works for me with android 14

@rom1v
Copy link
Collaborator

rom1v commented Nov 27, 2023

@gbil Both the camera capture and the device screen capture?

@gbil
Copy link

gbil commented Nov 27, 2023

@gbil Both the camera and the device?

should had clarified, I'm able to test only the device part

@benn02
Copy link
Author

benn02 commented Nov 27, 2023

I think 140a49b can fix it.

Please test:

 [`scrcpy-server`](https://tmp.rom1v.com/scrcpy/4467/5/scrcpy-server) `SHA-256: d3a1e798c490dd85e4bac19d5fb95b748f34f13c84676ddaa1f661ddb7ffc7e1`

This works for me for Device Share and Camera Share.

@rom1v
Copy link
Collaborator

rom1v commented Nov 27, 2023

Fix 140a49b merged into dev.

@moe7863
Copy link

moe7863 commented Nov 28, 2023

Also experiencing this issue. Do I have to wait until next build to obtain this fix? Using the Windows release. Thanks in advance

@rom1v
Copy link
Collaborator

rom1v commented Nov 28, 2023

@moe7863 No, the fix is in the first post of this thread.

@moe7863
Copy link

moe7863 commented Nov 28, 2023

Perfect, sorted thank you!

@Hajime-Hajime
Copy link

Hajime-Hajime commented Nov 28, 2023

Fix 140a49b merged into dev.

same(?) error on fedora linux. Samsung 14 android. Tried compile dev branch

scrcpy 2.3 <https://github.com/Genymobile/scrcpy>
WARN: Could not disable minimize on focus loss
INFO: ADB device found:
INFO:     -->   (usb)  R52TB0CVMKA                     device  SM_X806B
/usr/local/share/scrcpy/scrcpy-server: 1 file pushed, 0 skipped. 79.6 MB/s (65851 bytes in 0.001s)
[server] INFO: Device: [samsung] samsung SM-X806B (Android 14)
INFO: Renderer: opengl
INFO: OpenGL version: 4.6 (Compatibility Profile) Mesa 23.2.1
INFO: Trilinear filtering enabled
INFO: Texture: 2800x1752
ERROR: Demuxer 'audio': stream disabled due to connection error
ERROR: Demuxer error
[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
warning: queue 0x974190 destroyed while proxies still attached:
  wl_callback@44 still attached
  wl_surface@42 still attached

@rom1v
Copy link
Collaborator

rom1v commented Nov 28, 2023

Tried compile dev branch

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.

@saleembasit
Copy link

OK, just to confirm, the binary shared in the 1st post is working on MacOS Sonoma.

I had installed using brew, and upgraded from 2.2 to 2.3 and g=faced the exact issue as described by OP.

  1. Find your install location;
    sudo find / -name scrcpy-server

  2. Mine was found at;
    /usr/local/Cellar/scrcpy/2.3/share/scrcpy/scrcpy-server

  3. replaced using;
    sudo cp ~/Downloads/scrcpy-server /usr/local/Cellar/scrcpy/2.3/share/scrcpy/scrcpy-server

@jkoenig134
Copy link

Fix 140a49b merged into dev.

Also works for me. upgraded the server in my brew installation. When do you plan to release it?

@rom1v
Copy link
Collaborator

rom1v commented Dec 1, 2023

When do you plan to release it?

I will probably publish a 2.3.1 "soon".

@rom1v
Copy link
Collaborator

rom1v commented Dec 2, 2023

Fixed in 2.3.1.

@rom1v rom1v closed this as completed Dec 2, 2023
@lukasz18dg
Copy link

lukasz18dg commented Dec 2, 2023

I had earlier the same error code then I make below steps, because fix was merged.
Based on https://github.com/Genymobile/scrcpy/blob/master/doc/linux.md
I run two commands:

git pull
./install_release.sh

after update process finished I just run:

scrcpy

however on the start error code appear:

scrcpy 2.3.1 <https://github.com/Genymobile/scrcpy>
INFO: ADB device found:
INFO:     -->   (usb)  b7dd5582                        device  22101320G
/usr/local/share/scrcpy/scrcpy-server: 1 file pushed, 0 skipped. 242.8 MB/s (66007 bytes in 0.000s)
[server] INFO: Device: [Xiaomi] POCO 22101320G (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:226)
	at com.genymobile.scrcpy.Device.injectKeyEvent(Device.java:237)
	at com.genymobile.scrcpy.Device.pressReleaseKeycode(Device.java:245)
	at com.genymobile.scrcpy.Device.pressReleaseKeycode(Device.java:250)
	at com.genymobile.scrcpy.Controller.control(Controller.java:70)
	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
Caused by: android.os.RemoteException: Remote stack trace:
	at com.android.server.input.InputManagerService.injectInputEventToTarget(InputManagerService.java:912)
	at android.hardware.input.IInputManager$Stub.onTransact(IInputManager.java:617)
	at android.os.Binder.execTransactInternal(Binder.java:1285)
	at android.os.Binder.execTransact(Binder.java:1249)

INFO: Renderer: opengl
INFO: OpenGL version: 4.6 (Compatibility Profile) Mesa 23.2.1-1ubuntu3
INFO: Trilinear filtering enabled
INFO: Texture: 1080x240

similar/the same error code also appear after click on anything:

[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:226)
	at com.genymobile.scrcpy.Device.injectEvent(Device.java:230)
	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

I tried also check: scrcpy-server from first post, however for now I had errors about incompatibility client with server.

@lukasz18dg
Copy link

lukasz18dg commented Dec 3, 2023

Thanks! Great, works without any problems!

@463PFA
Copy link

463PFA commented Jan 11, 2024

On Win11 this week my keyboard and mouse stopped working, Samsung A13. Updated the files with the latest version from last month. Back OK now, yeah. Glad it's solved.

@ballo
Copy link

ballo commented Feb 10, 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

@ballo
Copy link

ballo commented Feb 10, 2024

Fixed in 2.3.1.

This may have fixed the previous version, but it's definitely broken in Android build# AP21.240119.009 security update Feb 5th 2024

Should I start a new issue or will this one be reopened?

@rom1v
Copy link
Collaborator

rom1v commented Feb 10, 2024

@ballo See #4656 #4657

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