-
-
Notifications
You must be signed in to change notification settings - Fork 10.7k
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
Comments
Could you try with by replacing this file in v1.13 release, please?
diffdiff --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. |
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. |
Out of curiosity, does this solve your problem:
? diffdiff --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) { |
Negative. This is the command prompt result with that file replaced:
|
And I assume I just replace that one file in the unzipped (compiled) Windows version, right? |
Your error means that the display returned here is
I don't know what we could do if we can't create the display :/ |
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... |
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. |
Same issue with Android 12 beta. |
@crazyserb Could you test with the binary posted in #2129, please? |
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 |
Same issue with Xiaomi MIBOX3 (Android 9) Environment:
Adb logcat:
|
Same issue on my side with Pixel 5 Beta 2. On my Samsung Galaxy s10e everything works fine. |
Same here, Google Pixel 4a 5G Android 12 Beta 2 Edit: |
Please read comments before posting. The two comments above reference #2129. Please read it. |
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) 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. |
Yes, it's:
Take v1.18. |
1.18 is behaving identically. I can use 1.5 only |
Hmm, that's very weird. Could you please post the whole console output with v1.18? |
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 |
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. |
I'm getting this exception on Ubuntu
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 |
Install manually the latest version: https://github.com/Genymobile/scrcpy/blob/master/BUILD.md#simple |
ok so i am haveing the same problem i am useing this on linux mint but it should be roughly the same. |
You need scrcpy >= 1.18 for Android 12. |
for android 13 need last version |
Installing Manually Works!!, thanks |
Environment
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.
The text was updated successfully, but these errors were encountered: