Skip to content

No screen mirroring on Meizu #6480

Closed
Closed

Description

@bqiss

Environment

  • OS: windows
  • Scrcpy version: 3.3.3
  • Device model: Meizu M1 E
  • Android version: 7.0

Describe the bug

After launching scrcpy v3.3.3, no screen mirroring appears, and the terminal shows no error messages.

However, when I use scrcpy v1.25, everything works normally.

When I compared the code of the two versions, I found a piece of useful code.
In the fillAppInfo method of Workarounds.java.
Application app = Instrumentation.newApplication(Application.class, ctx);

So I modified the code in v3.3.3:

private static void fillAppContext() {
        try {
            Application app;
            if (Build.BRAND.equalsIgnoreCase("meizu")) {
                app = Instrumentation.newApplication(Application.class, FakeContext.get());
            } else {
                app = new Application();
                Field baseField = ContextWrapper.class.getDeclaredField("mBase");
                baseField.setAccessible(true);
                baseField.set(app, FakeContext.get());
            }

            // activityThread.mInitialApplication = app;
            Field mInitialApplicationField = ACTIVITY_THREAD_CLASS.getDeclaredField("mInitialApplication");
            mInitialApplicationField.setAccessible(true);
            mInitialApplicationField.set(ACTIVITY_THREAD, app);
        } catch (Throwable throwable) {
            // this is a workaround, so failing is not an error
            Ln.d("Could not fill app context: " + throwable.getMessage());
        }
    }

I have not tested the compatibility of this line of code, so I only added a simple condition check, but it does work for me.

I hope this can help with your compatibility work!

Activity

  1. rom1v commented on Nov 14, 2025

    @rom1v
    Collaborator

    Looks good, it works on my devices too:

    diff --git server/src/main/java/com/genymobile/scrcpy/Workarounds.java server/src/main/java/com/genymobile/scrcpy/Workarounds.java
    index b89f19ae0..877491ee7 100644
    --- server/src/main/java/com/genymobile/scrcpy/Workarounds.java
    +++ server/src/main/java/com/genymobile/scrcpy/Workarounds.java
    @@ -6,6 +6,7 @@ import com.genymobile.scrcpy.util.Ln;
     import android.annotation.SuppressLint;
     import android.annotation.TargetApi;
     import android.app.Application;
    +import android.app.Instrumentation;
     import android.content.AttributionSource;
     import android.content.Context;
     import android.content.ContextWrapper;
    @@ -103,10 +104,7 @@ public final class Workarounds {
     
         private static void fillAppContext() {
             try {
    -            Application app = new Application();
    -            Field baseField = ContextWrapper.class.getDeclaredField("mBase");
    -            baseField.setAccessible(true);
    -            baseField.set(app, FakeContext.get());
    +            Application app = Instrumentation.newApplication(Application.class, FakeContext.get());
     
                 // activityThread.mInitialApplication = app;
                 Field mInitialApplicationField = ACTIVITY_THREAD_CLASS.getDeclaredField("mInitialApplication");

    Thank you.

  2. added a commit that references this issue on Nov 23, 2025
    7b49757
  3. rom1v commented on Nov 23, 2025

    @rom1v
    Collaborator

    Merged into dev: 9cfa5b1

  4. added a commit that references this issue on Nov 23, 2025
    9cfa5b1
  5. ghazyahmdfwad-jpg commented on May 10, 2026

    @ghazyahmdfwad-jpg

    يبدو جيداً، ويعمل على أجهزتي أيضاً:

    diff --git server/src/main/java/com/genymobile/scrcpy/Workarounds.java server/src/main/java/com/genymobile/scrcpy/Workarounds.java
    index b89f19ae0..877491ee7 100644
    --- server/src/main/java/com/genymobile/scrcpy/Workarounds.java
    +++ server/src/main/java/com/genymobile/scrcpy/Workarounds.java
    @@ -6,6 +6,7 @@ import com.genymobile.scrcpy.util.Ln;
    import android.annotation.SuppressLint;
    import android.annotation.TargetApi;
    import android.app.Application;
    +import android.app.Instrumentation;
    import android.content.AttributionSource;
    import android.content.Context;
    import android.content.ContextWrapper;
    @@ -103,10 +104,7 @@ public final class Workarounds {

     private static void fillAppContext() {
         try {
    
    •        Application app = new Application();
      
    •        Field baseField = ContextWrapper.class.getDeclaredField("mBase");
      
    •        baseField.setAccessible(true);
      
    •        baseField.set(app, FakeContext.get());
      
    •        Application app = Instrumentation.newApplication(Application.class, FakeContext.get());
      
             // activityThread.mInitialApplication = app;
             Field mInitialApplicationField = ACTIVITY_THREAD_CLASS.getDeclaredField("mInitialApplication");
      

    شكرًا لك.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions