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

ERROR: java.lang.IllegalArgumentException: displayToken must not be null (Windows 1.13 compiled version with Android 9) #1409

Closed
2 tasks done
crazyserb opened this issue May 20, 2020 · 30 comments

Comments

@crazyserb
Copy link

crazyserb commented May 20, 2020

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

Environment

  • OS: Windows 10
  • scrcpy version: [e.g. 1.13]
  • installation method: Windows compiled version
  • device model: Xiaomi MI BOX 4K
  • Android version: 9

I was able to connect to Android v8.1 on this box, but ever since the update to 9.0 I am getting this random error, not sure how to get past it.

Any ideas?

Thanks.

C:\cpy>scrcpy --render-driver=opengl
INFO: scrcpy 1.13 <https://github.com/Genymobile/scrcpy>
C:\cpy\scrcpy-server: 1 file pushed. 2.0 MB/s (27694 bytes in 0.013s)
[server] INFO: Device: Xiaomi MIBOX4 (Android 9)
[server] ERROR: Exception on thread Thread[main,5,main]
java.lang.AssertionError: java.lang.reflect.InvocationTargetException
        at com.genymobile.scrcpy.wrappers.SurfaceControl.setDisplaySurface(SurfaceControl.java:75)
        at com.genymobile.scrcpy.ScreenEncoder.setDisplaySurface(ScreenEncoder.java:177)
        at com.genymobile.scrcpy.ScreenEncoder.streamScreen(ScreenEncoder.java:71)
        at com.genymobile.scrcpy.Server.scrcpy(Server.java:35)
        at com.genymobile.scrcpy.Server.main(Server.java:177)
        at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
        at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:340)
Caused by: java.lang.reflect.InvocationTargetException
        at java.lang.reflect.Method.invoke(Native Method)
        at com.genymobile.scrcpy.wrappers.SurfaceControl.setDisplaySurface(SurfaceControl.java:73)
        ... 6 more
Caused by: java.lang.IllegalArgumentException: displayToken must not be null
        at android.view.SurfaceControl$Transaction.setDisplaySurface(SurfaceControl.java:1625)
        at android.view.SurfaceControl.setDisplaySurface(SurfaceControl.java:1117)
        ... 8 more
INFO: Renderer: opengl
INFO: OpenGL version: 4.0.0 - Build 10.18.10.4252
INFO: Trilinear filtering enabled
INFO: Initial texture: 1920x1080
WARN: Device disconnected
Press any key to continue...
@crazyserb crazyserb changed the title ERROR: Exception on thread Thread[main,5,main] (Windows 1.13 compiled version, connecting to Android 9) ERROR: Exception on thread Thread[main,5,main] // java.lang.IllegalArgumentException: displayToken must not be null (Windows 1.13 compiled version with Android 9) May 20, 2020
@rom1v rom1v changed the title ERROR: Exception on thread Thread[main,5,main] // java.lang.IllegalArgumentException: displayToken must not be null (Windows 1.13 compiled version with Android 9) ERROR: java.lang.IllegalArgumentException: displayToken must not be null (Windows 1.13 compiled version with Android 9) May 20, 2020
@rom1v
Copy link
Collaborator

rom1v commented May 20, 2020

Could you try with by replacing this file in v1.13 release, please?

  • scrcpy-server
    SHA256: 3ec5620aa1efaef1cd84406a1aa4e7f9b92387702a607eb4793b5881ec2a4ef9
diff
diff --git a/server/src/main/java/com/genymobile/scrcpy/wrappers/SurfaceControl.java b/server/src/main/java/com/genymobile/scrcpy/wrappers/SurfaceControl.java
index 8fbb860..f354d7d 100644
--- a/server/src/main/java/com/genymobile/scrcpy/wrappers/SurfaceControl.java
+++ b/server/src/main/java/com/genymobile/scrcpy/wrappers/SurfaceControl.java
@@ -29,6 +29,7 @@ public final class SurfaceControl {
     }
 
     private static Method getBuiltInDisplayMethod;
+    private static boolean getBuiltInDisplayMethodLegacy;
     private static Method setDisplayPowerModeMethod;
 
     private SurfaceControl() {
@@ -88,10 +89,12 @@ public final class SurfaceControl {
         if (getBuiltInDisplayMethod == null) {
             // the method signature has changed in Android Q
             // <https://github.com/Genymobile/scrcpy/issues/586>
-            if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q) {
-                getBuiltInDisplayMethod = CLASS.getMethod("getBuiltInDisplay", int.class);
-            } else {
+            try {
                 getBuiltInDisplayMethod = CLASS.getMethod("getInternalDisplayToken");
+            } catch (NoSuchMethodException e) {
+                // old version
+                getBuiltInDisplayMethod = CLASS.getMethod("getBuiltInDisplay", int.class);
+                getBuiltInDisplayMethodLegacy = true;
             }
         }
         return getBuiltInDisplayMethod;
@@ -101,12 +104,12 @@ public final class SurfaceControl {
 
         try {
             Method method = getGetBuiltInDisplayMethod();
-            if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q) {
-                // call getBuiltInDisplay(0)
+            if (getBuiltInDisplayMethodLegacy) {
+                // old version, call getBuiltInDisplay(0)
                 return (IBinder) method.invoke(null, 0);
             }
 
-            // call getInternalDisplayToken()
+            // new version, call getInternalDisplayToken()
             return (IBinder) method.invoke(null);
         } catch (InvocationTargetException | IllegalAccessException | NoSuchMethodException e) {
             Ln.e("Could not invoke method", e);

EDIT: Oh, this is not the same context as #835, I guess this change will not fix your problem.

@crazyserb
Copy link
Author

crazyserb commented May 20, 2020

Do you know what is causing the problem in my case? And how to fix it?

As I can't go back in time and downgrade this box from Android 9 to Android 8 to get back the ability to log into it and use scrcpy.

@rom1v
Copy link
Collaborator

rom1v commented May 20, 2020

Out of curiosity, does this solve your problem:

  • scrcpy-server
    SHA256: b06180b78039cc956a82b84eed8c740ceec4d90702c86cdb61ca918a030f42c8

?

diff
diff --git a/server/src/main/java/com/genymobile/scrcpy/ScreenEncoder.java b/server/src/main/java/com/genymobile/scrcpy/ScreenEncoder.java
index fc1a25b..9bc4127 100644
--- a/server/src/main/java/com/genymobile/scrcpy/ScreenEncoder.java
+++ b/server/src/main/java/com/genymobile/scrcpy/ScreenEncoder.java
@@ -159,7 +159,7 @@ public class ScreenEncoder implements Device.RotationListener {
     }
 
     private static IBinder createDisplay() {
-        return SurfaceControl.createDisplay("scrcpy", true);
+        return SurfaceControl.createDisplay("scrcpy", false);
     }
 
     private static void configure(MediaCodec codec, MediaFormat format) {

@crazyserb
Copy link
Author

crazyserb commented May 20, 2020

Negative.

This is the command prompt result with that file replaced:

INFO: scrcpy 1.13 <https://github.com/Genymobile/scrcpy>
C:\cpy\scrcpy-server: 1 file pushed. 2.7 MB/s (40739 bytes in 0.014s)
[server] INFO: Device: Xiaomi MIBOX4 (Android 9)
[server] DEBUG: Controller stopped
[server] ERROR: Exception on thread Thread[main,5,main]
java.lang.AssertionError: java.lang.reflect.InvocationTargetException
        at com.genymobile.scrcpy.wrappers.SurfaceControl.setDisplaySurface(SurfaceControl.java:75)
        at com.genymobile.scrcpy.ScreenEncoder.setDisplaySurface(ScreenEncoder.java:177)
        at com.genymobile.scrcpy.ScreenEncoder.streamScreen(ScreenEncoder.java:71)
        at com.genymobile.scrcpy.Server.scrcpy(Server.java:35)
        at com.genymobile.scrcpy.Server.main(Server.java:177)
        at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
        at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:340)
Caused by: java.lang.reflect.InvocationTargetException
        at java.lang.reflect.Method.invoke(Native Method)
        at com.genymobile.scrcpy.wrappers.SurfaceControl.setDisplaySurface(SurfaceControl.java:73)
        ... 6 more
Caused by: java.lang.IllegalArgumentException: displayToken must not be null
        at android.view.SurfaceControl$Transaction.setDisplaySurface(SurfaceControl.java:1625)
        at android.view.SurfaceControl.setDisplaySurface(SurfaceControl.java:1117)
        ... 8 more
INFO: Renderer: opengl
INFO: OpenGL version: 4.0.0 - Build 10.18.10.4252
INFO: Trilinear filtering enabled
INFO: Initial texture: 1024x576
WARN: Device disconnected
Press any key to continue...``` 

@crazyserb
Copy link
Author

And I assume I just replace that one file in the unzipped (compiled) Windows version, right?

@rom1v
Copy link
Collaborator

rom1v commented May 20, 2020

Your error means that the display returned here is null:

I don't know what we could do if we can't create the display :/

@crazyserb
Copy link
Author

So weird... that this happens on Android 9, even though I've seen this software work just fine on others' Android 9's and 10's.

What could have the Xiaomi guys cooked up in that Android 9 update to break all this...

@pjd493
Copy link

pjd493 commented Jun 7, 2020

Same issue here. Trying to connect an Amazon Fire Kindle ( Android 9 ) .. I'm updating the Fire OS but I doubt that will do anything.

@biafra23
Copy link

Same issue with Android 12 beta.
scrcpy version 1.17_1

@rom1v
Copy link
Collaborator

rom1v commented May 25, 2021

@crazyserb Could you test with the binary posted in #2129, please?

@rom1v
Copy link
Collaborator

rom1v commented May 27, 2021

@pjd493 Could you also test with the binaries posted in #2129 please?

@ArchWizard56
Copy link

Could you try with by replacing this file in v1.13 release, please?

* [`scrcpy-server`](https://tmp.rom1v.com/scrcpy/issue1409/1/scrcpy-server)
  _SHA256: 3ec5620aa1efaef1cd84406a1aa4e7f9b92387702a607eb4793b5881ec2a4ef9_

diff

EDIT: Oh, this is not the same context as #835, I guess this change will not fix your problem.

Hi, I'm running the Android beta and applying this patch to the dev branch fixed the issue for me on my Google Pixel 5.

Thanks for your hard work.

~Archwizard

@ViaDroid
Copy link

Same issue with Xiaomi MIBOX3 (Android 9)

Environment:

OS: Ubuntu 20.04.2 LTS
scrcpy version 1.17
apt install scrcpy
device model: Xiaomi MIBOX3
Android version: 9

INFO: scrcpy 1.17 <https://github.com/Genymobile/scrcpy>
/usr/local/share/scrcpy/scrcpy-server: 1 file pushed, 0 skipped. 121.3 MB/s (34930 bytes in 0.000s)
[server] INFO: Device: Xiaomi MIBOX3 (Android 9)
[server] ERROR: Exception on thread Thread[main,5,main]
java.lang.AssertionError: java.lang.reflect.InvocationTargetException
	at com.genymobile.scrcpy.wrappers.SurfaceControl.setDisplaySurface(SurfaceControl.java:75)
	at com.genymobile.scrcpy.ScreenEncoder.setDisplaySurface(ScreenEncoder.java:243)
	at com.genymobile.scrcpy.ScreenEncoder.internalStreamScreen(ScreenEncoder.java:91)
	at com.genymobile.scrcpy.ScreenEncoder.streamScreen(ScreenEncoder.java:60)
	at com.genymobile.scrcpy.Server.scrcpy(Server.java:80)
	at com.genymobile.scrcpy.Server.main(Server.java:252)
	at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
	at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:340)
Caused by: java.lang.reflect.InvocationTargetException
	at java.lang.reflect.Method.invoke(Native Method)
	at com.genymobile.scrcpy.wrappers.SurfaceControl.setDisplaySurface(SurfaceControl.java:73)
	... 7 more
Caused by: java.lang.IllegalArgumentException: displayToken must not be null
	at android.view.SurfaceControl$Transaction.setDisplaySurface(SurfaceControl.java:1625)
	at android.view.SurfaceControl.setDisplaySurface(SurfaceControl.java:1117)
	... 9 more
INFO: Renderer: opengl
INFO: OpenGL version: 3.0 Mesa 20.0.8
INFO: Trilinear filtering enabled
INFO: Initial texture: 1920x1080
WARN: Device disconnected
WARN: Killing the server...

Adb logcat:

05-29 15:19:24.184  3184  3213 E OMXNodeInstance: getParameter(0xf5983ba8:amlogic.encoder.avc, ??(0x7f000007)) ERROR: UnsupportedSetting(0x80001019)
05-29 15:19:24.185 14078 14092 W OMXUtils: do not know color format 0x7f000789 = 2130708361
05-29 15:19:24.185  3184 10509 E OMXNodeInstance: getConfig(0xf5983ba8:amlogic.encoder.avc, ??(0x7f00000c)) ERROR: UnsupportedIndex(0x8000101a)
05-29 15:19:24.185 14078 14092 W ACodec  : [OMX.amlogic.video.encoder.avc] getting color aspects failed even though codec advertises support
05-29 15:19:24.185  3184 10509 E OMXNodeInstance: getConfig(0xf5983ba8:amlogic.encoder.avc, ConfigLatency(0x6f800005)) ERROR: UnsupportedIndex(0x8000101a)
05-29 15:19:24.186  3184  3213 E OMXNodeInstance: getConfig(0xf5983ba8:amlogic.encoder.avc, ConfigAndroidVendorExtension(0x6f100004)) ERROR: UnsupportedIndex(0x8000101a)
05-29 15:19:24.187  3184  3184 E OMXNodeInstance: getConfig(0xf5983ba8:amlogic.encoder.avc, ConfigAndroidIntraRefresh(0x6f60000a)) ERROR: UnsupportedIndex(0x8000101a)
05-29 15:19:24.187  3184  3213 E OMXNodeInstance: getParameter(0xf5983ba8:amlogic.encoder.avc, ParamVideoIntraRefresh(0x6000006)) ERROR: UnsupportedIndex(0x8000101a)
05-29 15:19:24.190  3184  3213 D OmxComponent: setConfig 1116
05-29 15:19:24.190  3184  3213 E OMXNodeInstance: setConfig(0xf5983ba8:amlogic.encoder.avc, ??(0x7f00000c)) ERROR: UnsupportedIndex(0x8000101a)
05-29 15:19:24.190 14078 14092 W ACodec  : [OMX.amlogic.video.encoder.avc] setting color aspects failed even though codec advertises support
05-29 15:19:24.190  3184  3184 E OMXNodeInstance: getConfig(0xf5983ba8:amlogic.encoder.avc, ??(0x7f00000c)) ERROR: UnsupportedIndex(0x8000101a)
05-29 15:19:24.190  3184  3184 E OMXNodeInstance: getConfig(0xf5983ba8:amlogic.encoder.avc, ??(0x7f00000c)) ERROR: UnsupportedIndex(0x8000101a)
05-29 15:19:24.190 14078 14092 W ACodec  : [OMX.amlogic.video.encoder.avc] getting color aspects failed even though codec advertises support
05-29 15:19:24.191  3184  3213 D OmxComponent: getExtensionIndex 1123 name="OMX.google.android.index.storeANWBufferInMetadata"
05-29 15:19:24.191  3184  3213 D OmxComponent: getExtensionIndex 1123 name="OMX.google.android.index.storeMetaDataInBuffers"
05-29 15:19:24.191  3184  3213 E OMXNodeInstance: getParameter(0xf5983ba8:amlogic.encoder.avc, ParamConsumerUsageBits(0x6f800004)) ERROR: UnsupportedIndex(0x8000101a)
05-29 15:19:24.191  3184  3213 D GraphicBufferSource: setting dataspace: 0x104, acquired=0
05-29 15:19:24.191  3184  3184 E OMXNodeInstance: getParameter(0xf5983ba8:amlogic.encoder.avc, ParamConsumerUsageBits(0x6f800004)) ERROR: UnsupportedIndex(0x8000101a)
05-29 15:19:24.192  3184  3184 D GraphicBufferSource: requesting color aspects (R:2(Limited), P:1(BT709_5), M:1(BT709_5), T:3(SMPTE170M))
05-29 15:19:24.193 14078 14078 D OpenGLRenderer: Skia GL Pipeline
05-29 15:19:24.196 14078 14078 D AndroidRuntime: Shutting down VM
05-29 15:19:24.197 14078 14078 E AndroidRuntime: FATAL EXCEPTION: main
05-29 15:19:24.197 14078 14078 E AndroidRuntime: PID: 14078
05-29 15:19:24.197 14078 14078 E AndroidRuntime: java.lang.AssertionError: java.lang.reflect.InvocationTargetException
05-29 15:19:24.197 14078 14078 E AndroidRuntime: 	at com.genymobile.scrcpy.wrappers.SurfaceControl.setDisplaySurface(SurfaceControl.java:75)
05-29 15:19:24.197 14078 14078 E AndroidRuntime: 	at com.genymobile.scrcpy.ScreenEncoder.setDisplaySurface(ScreenEncoder.java:243)
05-29 15:19:24.197 14078 14078 E AndroidRuntime: 	at com.genymobile.scrcpy.ScreenEncoder.internalStreamScreen(ScreenEncoder.java:91)
05-29 15:19:24.197 14078 14078 E AndroidRuntime: 	at com.genymobile.scrcpy.ScreenEncoder.streamScreen(ScreenEncoder.java:60)
05-29 15:19:24.197 14078 14078 E AndroidRuntime: 	at com.genymobile.scrcpy.Server.scrcpy(Server.java:80)
05-29 15:19:24.197 14078 14078 E AndroidRuntime: 	at com.genymobile.scrcpy.Server.main(Server.java:252)
05-29 15:19:24.197 14078 14078 E AndroidRuntime: 	at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
05-29 15:19:24.197 14078 14078 E AndroidRuntime: 	at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:340)
05-29 15:19:24.197 14078 14078 E AndroidRuntime: Caused by: java.lang.reflect.InvocationTargetException
05-29 15:19:24.197 14078 14078 E AndroidRuntime: 	at java.lang.reflect.Method.invoke(Native Method)
05-29 15:19:24.197 14078 14078 E AndroidRuntime: 	at com.genymobile.scrcpy.wrappers.SurfaceControl.setDisplaySurface(SurfaceControl.java:73)
05-29 15:19:24.197 14078 14078 E AndroidRuntime: 	... 7 more
05-29 15:19:24.197 14078 14078 E AndroidRuntime: Caused by: java.lang.IllegalArgumentException: displayToken must not be null
05-29 15:19:24.197 14078 14078 E AndroidRuntime: 	at android.view.SurfaceControl$Transaction.setDisplaySurface(SurfaceControl.java:1625)
05-29 15:19:24.197 14078 14078 E AndroidRuntime: 	at android.view.SurfaceControl.setDisplaySurface(SurfaceControl.java:1117)
05-29 15:19:24.197 14078 14078 E AndroidRuntime: 	... 9 more
05-29 15:19:24.197 14078 14078 E scrcpy  : Exception on thread Thread[main,5,main]
05-29 15:19:24.197 14078 14078 E scrcpy  : java.lang.AssertionError: java.lang.reflect.InvocationTargetException
05-29 15:19:24.197 14078 14078 E scrcpy  : 	at com.genymobile.scrcpy.wrappers.SurfaceControl.setDisplaySurface(SurfaceControl.java:75)
05-29 15:19:24.197 14078 14078 E scrcpy  : 	at com.genymobile.scrcpy.ScreenEncoder.setDisplaySurface(ScreenEncoder.java:243)
05-29 15:19:24.197 14078 14078 E scrcpy  : 	at com.genymobile.scrcpy.ScreenEncoder.internalStreamScreen(ScreenEncoder.java:91)
05-29 15:19:24.197 14078 14078 E scrcpy  : 	at com.genymobile.scrcpy.ScreenEncoder.streamScreen(ScreenEncoder.java:60)
05-29 15:19:24.197 14078 14078 E scrcpy  : 	at com.genymobile.scrcpy.Server.scrcpy(Server.java:80)
05-29 15:19:24.197 14078 14078 E scrcpy  : 	at com.genymobile.scrcpy.Server.main(Server.java:252)
05-29 15:19:24.197 14078 14078 E scrcpy  : 	at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
05-29 15:19:24.197 14078 14078 E scrcpy  : 	at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:340)
05-29 15:19:24.197 14078 14078 E scrcpy  : Caused by: java.lang.reflect.InvocationTargetException
05-29 15:19:24.197 14078 14078 E scrcpy  : 	at java.lang.reflect.Method.invoke(Native Method)
05-29 15:19:24.197 14078 14078 E scrcpy  : 	at com.genymobile.scrcpy.wrappers.SurfaceControl.setDisplaySurface(SurfaceControl.java:73)
05-29 15:19:24.197 14078 14078 E scrcpy  : 	... 7 more
05-29 15:19:24.197 14078 14078 E scrcpy  : Caused by: java.lang.IllegalArgumentException: displayToken must not be null
05-29 15:19:24.197 14078 14078 E scrcpy  : 	at android.view.SurfaceControl$Transaction.setDisplaySurface(SurfaceControl.java:1625)
05-29 15:19:24.197 14078 14078 E scrcpy  : 	at android.view.SurfaceControl.setDisplaySurface(SurfaceControl.java:1117)
05-29 15:19:24.197 14078 14078 E scrcpy  : 	... 9 more
05-29 15:19:24.250  6404  6491 E chromium: [6404:6491:ERROR:wifi_util.cc(72)] Cannot do SIOCGIWFREQ for wifi: Operation not permitted (1)
05-29 15:19:24.675 14087 14087 I AVUtils : createInstance(32bit) : _ZN7android19createExtendedUtilsEv
05-29 15:19:24.684 14087 14087 I AVUtils : createInstance(32bit) : _ZN7android19createExtendedUtilsEv
05-29 15:19:24.685 14087 14087 I AVUtils : Opened libavenhancements.so
05-29 15:19:24.685 14087 14087 I AVUtils : symbol _ZN7android19createExtendedUtilsEv found:  (null)
05-29 15:19:24.685 14087 14087 I AVUtils : CREATE function success
05-29 15:19:24.685 14087 14087 I AVUtils : Opened libavenhancements.so
05-29 15:19:24.685 14087 14087 I AVUtils : symbol _ZN7android19createExtendedUtilsEv found:  (null)
05-29 15:19:24.685 14087 14087 I AVUtils : CREATE function success
05-29 15:19:24.685 14087 14087 I AVUtils : createInstance(32bit) : _ZN7android19createExtendedUtilsEv
05-29 15:19:24.685 14087 14087 I AVUtils : symbol _ZN7android19createExtendedUtilsEv found:  (null)
05-29 15:19:24.685 14087 14087 I AVUtils : CREATE function success
05-29 15:19:24.685 14087 14087 D AndroidRuntime: >>>>>> START com.android.internal.os.RuntimeInit uid 2000 <<<<<<
05-29 15:19:24.889 14087 14087 W app_process: Using default instruction set features for ARM CPU variant (cortex-a9) using conservative defaults
05-29 15:19:24.955 14087 14087 D AndroidRuntime: Calling main entry com.genymobile.scrcpy.CleanUp
05-29 15:19:25.289  6404  6491 E chromium: [6404:6491:ERROR:wifi_util.cc(72)] Cannot do SIOCGIWFREQ for wifi: Operation not permitted (1)
05-29 15:19:25.297  3471  3471 I BleRemoteService: onLeScan device=EC:55:E5:3E:60:29 rssi=-67
05-29 15:19:25.323  6050  6213 D MessageManager: check houseKeeping message
05-29 15:19:25.323  6050  6213 D MessageManager: check Delivery message
05-29 15:19:25.335  3184  3184 E OMXNodeInstance: !!! Observer died. Quickly, do something, ... anything...
05-29 15:19:25.336  3184  3184 D OmxComponentManagerImpl: DecreaseEntryNumByName pEntry->mNum=1, pEntry->mMaxNum:3,componentName:OMX.amlogic.video.encoder.avc
05-29 15:19:25.336  3184  3184 I omx_core: OMX_freeHandle_num_= 0
05-29 15:19:25.336  3184  3184 D OmxVideoEncoder: ~OmxVideoEncoder
05-29 15:19:25.338 14087 14087 I scrcpy  : Cleaning up
05-29 15:19:25.340 14087 14087 I scrcpy  : Restoring normal power mode
05-29 15:19:25.346  3041  3077 E SurfaceFlinger: Permission Denial: can't access SurfaceFlinger pid=14087, uid=2000
05-29 15:19:25.347 14087 14087 D AndroidRuntime: Shutting down VM

@rom1v
Copy link
Collaborator

rom1v commented May 29, 2021

@ViaDroid Is it better with the binaries from #2129?

@BartlomiejFrankow
Copy link

Same issue on my side with Pixel 5 Beta 2. On my Samsung Galaxy s10e everything works fine.

@rom1v
Copy link
Collaborator

rom1v commented Jun 15, 2021

@BartlomiejFrankow #2129

@fabian310
Copy link

fabian310 commented Jun 17, 2021

Same here, Google Pixel 4a 5G Android 12 Beta 2

Edit:
Just found an old version. Version 1.2 still works, if that helps.

@rom1v
Copy link
Collaborator

rom1v commented Jun 17, 2021

Please read comments before posting. The two comments above reference #2129. Please read it.

@maeeh
Copy link

maeeh commented Jul 1, 2021

Have the same issue as fabian310, same device and Beta as well. Tested the older versions and it seems 1.5 is the last one working for our config.

According to the release notes, the following was changed:

**Changes since v1.5:

Mirror secure content (#36)
Fix warning "Invalid return value 0 for stream protocol" (#333)
Correctly handle mouse events outside device screen (#353, #357)
Avoid empty arguments not correctly handled on some devices (#337)
Keep screensaver enabled while scrcpy is running (#380)
Update FFmpeg to 4.1 included in Windows releases
**

I testes up to 1.10 and decided at that point that most likely 1.6 brought something in that is causing issues with Androud 12.

@rom1v
Copy link
Collaborator

rom1v commented Jul 1, 2021

decided at that point that most likely 1.6 brought something in that is causing issues with Androud 12.

Yes, it's:

Mirror secure content (#36)

Take v1.18.

@maeeh
Copy link

maeeh commented Jul 1, 2021

1.18 is behaving identically. I can use 1.5 only

@rom1v
Copy link
Collaborator

rom1v commented Jul 1, 2021

Hmm, that's very weird.

Could you please post the whole console output with v1.18?

@maeeh
Copy link

maeeh commented Jul 1, 2021

My bad, seems i accidentaly installed 1.14 and was thinking it is the actual version. Loaded 1.18 now and everythings fine. Sorry for the inconviniences

@rom1v rom1v closed this as completed Oct 27, 2021
@crazyserb
Copy link
Author

Well, I am glad to report that the latest version with all these changes fixes my originally reported issue above, and everything works fine with my device now.

Amazing... and thank you again for seeing it through.

@ipolevoy
Copy link

I'm getting this exception on Ubuntu

  • scrcpy version: 1.12.1
$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 20.04.3 LTS
Release:	20.04
Codename:	focal

I know this is fixed in the 1.21 version, but I only get the 1.12.1 when I install scrcpy .

Any help is much appreciated

@rom1v
Copy link
Collaborator

rom1v commented Jan 18, 2022

I know this is fixed in the 1.21 version, but I only get the 1.12.1 when I install scrcpy .

Install manually the latest version: https://github.com/Genymobile/scrcpy/blob/master/BUILD.md#simple

@Greengamer077
Copy link

ok so i am haveing the same problem i am useing this on linux mint but it should be roughly the same.
so here is what pops up when i run it with it all set up
[server] ERROR: Exception on thread Thread[main,5,main] java.lang.AssertionError: java.lang.reflect.InvocationTargetException at com.genymobile.scrcpy.wrappers.SurfaceControl.setDisplaySurface(SurfaceControl.java:75) at com.genymobile.scrcpy.ScreenEncoder.setDisplaySurface(ScreenEncoder.java:178) at com.genymobile.scrcpy.ScreenEncoder.streamScreen(ScreenEncoder.java:70) at com.genymobile.scrcpy.Server.scrcpy(Server.java:34) at com.genymobile.scrcpy.Server.main(Server.java:163) at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method) at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:374) Caused by: java.lang.reflect.InvocationTargetException at java.lang.reflect.Method.invoke(Native Method) at com.genymobile.scrcpy.wrappers.SurfaceControl.setDisplaySurface(SurfaceControl.java:73) WARN: Device disconnected ... 6 more Caused by: java.lang.IllegalArgumentException: displayToken must not be null at android.view.SurfaceControl$Transaction.setDisplaySurface(SurfaceControl.java:3372) at android.view.SurfaceControl.setDisplaySurface(SurfaceControl.java:2346) ... 8 more
HELP

@rom1v
Copy link
Collaborator

rom1v commented Apr 9, 2022

You need scrcpy >= 1.18 for Android 12.

@rogergcc
Copy link

for android 13 need last version

@abelayalew
Copy link

I know this is fixed in the 1.21 version, but I only get the 1.12.1 when I install scrcpy .

Install manually the latest version: https://github.com/Genymobile/scrcpy/blob/master/BUILD.md#simple

Installing Manually Works!!, thanks

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