-
-
Notifications
You must be signed in to change notification settings - Fork 10.9k
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
Version 1.11 error with Nvidia ShieldTV 2015 (Android 9 Pie / SDK Version 28) #940
Comments
Thank you for your report. If you try again v1.10, does it work? |
Yes, v1.10 works perfectly fine |
Could you retry with this change, please? diff --git a/server/src/main/java/com/genymobile/scrcpy/ScreenEncoder.java b/server/src/main/java/com/genymobile/scrcpy/ScreenEncoder.java
index c9a37f8..504e954 100644
--- a/server/src/main/java/com/genymobile/scrcpy/ScreenEncoder.java
+++ b/server/src/main/java/com/genymobile/scrcpy/ScreenEncoder.java
@@ -53,7 +53,6 @@ public class ScreenEncoder implements Device.RotationListener {
public void streamScreen(Device device, FileDescriptor fd) throws IOException {
Workarounds.prepareMainLooper();
- Workarounds.fillAppInfo();
MediaFormat format = createFormat(bitRate, maxFps, iFrameInterval);
device.setRotationListener(this); |
That's it! It works with your patch applied. |
OK, so this conflicts with #365 (which only works with the call to |
Would it be sensible to call it only for devices that are known to not work without it?
|
If you restore diff --git a/server/src/main/java/com/genymobile/scrcpy/Workarounds.java b/server/src/main/java/com/genymobile/scrcpy/Workarounds.java
index f45d82a..ba5cd21 100644
--- a/server/src/main/java/com/genymobile/scrcpy/Workarounds.java
+++ b/server/src/main/java/com/genymobile/scrcpy/Workarounds.java
@@ -1,11 +1,15 @@
package com.genymobile.scrcpy;
import android.annotation.SuppressLint;
+import android.app.Application;
+import android.app.Instrumentation;
+import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.os.Looper;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
+import java.lang.reflect.Method;
public final class Workarounds {
private Workarounds() {
@@ -56,6 +60,14 @@ public final class Workarounds {
Field mBoundApplicationField = activityThreadClass.getDeclaredField("mBoundApplication");
mBoundApplicationField.setAccessible(true);
mBoundApplicationField.set(activityThread, appBindData);
+
+ Method getSystemContextMethod = activityThreadClass.getDeclaredMethod("getSystemContext");
+ // this is not a full Android context giving access to everything
+ Context ctx = (Context) getSystemContextMethod.invoke(activityThread);
+ Application app = Instrumentation.newApplication(Application.class, ctx);
+ Field mInitialApplicationField = activityThreadClass.getDeclaredField("mInitialApplication");
+ mInitialApplicationField.setAccessible(true);
+ mInitialApplicationField.set(activityThread, app);
} catch (Throwable throwable) {
// this is a workaround, so failing is not an error
Ln.w("Could not fill app info: " + throwable.getMessage()); |
Just tried and it works |
Merged on |
Is there somewhere I can download dev builds? |
No, this will be in v1.12 (which should be released soon, hopefully). Meanwhile, you can use v1.10. |
(v1.12 which fixes the problem is out) |
To fix #994, I changed the way the workaround is called. Could you please take scrcpy v1.13 and replace this file:
and confirm that it works without any error message. Thank you. |
To avoid NullPointerException on some devices, workarounds have been implemented. But these workaround produce (harmless) internal errors causing exceptions to be printed in the console. To avoid this problem, apply the workarounds only if it fails without them. Fixes #994 <#994> Refs #365 <#365> Refs #940 <#940>
Workarounds.fillAppInfo() is necessary for Meizu devices even before the first call to internalStreamScreen(), but it is harmful on other devices (#940). Therefore, simplify the workaround, by calling fillAppInfo() only if Build.BRAND equals "meizu" (case insensitive). Fixes #240 <#240> (again) Fixes #2656 <#2656>
Workarounds.fillAppInfo() is necessary for Meizu devices even before the first call to internalStreamScreen(), but it is harmful on other devices (#940). Therefore, simplify the workaround, by calling fillAppInfo() only if Build.BRAND equals "meizu" (case insensitive). Fixes #240 <#240> (again) Fixes #2656 <#2656>
Workarounds were disabled by default, and enabled only on some device or in specific conditions. But it seems they are needed for more and more devices, so enable them by default. They could be disabled for specific devices if necessary. --- Cases where workarounds caused issues: - <#940>: To be tested - <#3805 (comment)>: To be tested - <#4015 (comment)>: This is not a problem anymore since commit b8c5853.
Could you please test #5154 and confirm that it still works? |
Workarounds were disabled by default, and enabled only on some device or in specific conditions. But it seems they are needed for more and more devices, so enable them by default. They could be disabled for specific devices if necessary in the future. In the past, these workarounds caused a (harmless) exception to be printed on some Xiaomi devices [1]. But this is not a problem anymore since commit b8c5853. They also caused problems for audio on Vivo devices [2], but it seems this is not the case anymore [3]. They might also impact an old Nvidia Shield [4], but hopefully this is fixed now. [1]: <#4015 (comment)> [2]: <#3805 (comment)> [3]: <#3805 (comment)> [4]: <#940> PR #5154 <#5154>
Workarounds were disabled by default, and only enabled for some devices or under specific conditions. But it seems they are needed for more and more devices, so enable them by default. They could be disabled for specific devices if necessary in the future. In the past, these workarounds caused a (harmless) exception to be printed on some Xiaomi devices [1]. But this is not a problem anymore since commit b8c5853. They also caused problems for audio on Vivo devices [2], but it seems this is not the case anymore [3]. They might also impact an old Nvidia Shield [4], but hopefully this is fixed now. [1]: <#4015 (comment)> [2]: <#3805 (comment)> [3]: <#3805 (comment)> [4]: <#940> PR #5154 <#5154>
Workarounds were disabled by default, and only enabled for some devices or under specific conditions. But it seems they are needed for more and more devices, so enable them by default. They could be disabled for specific devices if necessary in the future. In the past, these workarounds caused a (harmless) exception to be printed on some Xiaomi devices [1]. But this is not a problem anymore since commit b8c5853. They also caused problems for audio on Vivo devices [2], but it seems this is not the case anymore [3]. They might also impact an old Nvidia Shield [4], but hopefully this is fixed now. [1]: <Genymobile#4015 (comment)> [2]: <Genymobile#3805 (comment)> [3]: <Genymobile#3805 (comment)> [4]: <Genymobile#940> PR Genymobile#5154 <Genymobile#5154>
Workarounds were disabled by default, and only enabled for some devices or under specific conditions. But it seems they are needed for more and more devices, so enable them by default. They could be disabled for specific devices if necessary in the future. In the past, these workarounds caused a (harmless) exception to be printed on some Xiaomi devices [1]. But this is not a problem anymore since commit b8c5853. They also caused problems for audio on Vivo devices [2], but it seems this is not the case anymore [3]. They might also impact an old Nvidia Shield [4], but hopefully this is fixed now. [1]: <Genymobile#4015 (comment)> [2]: <Genymobile#3805 (comment)> [3]: <Genymobile#3805 (comment)> [4]: <Genymobile#940> PR Genymobile#5154 <Genymobile#5154>
After updating from
1.10
to1.11
scrcpy is no longer working with my ShieldTV.The text was updated successfully, but these errors were encountered: