Skip to content

Multipleflutters Android Failed to spawn new JNI connected shell from existing shell #78389

Closed
flutter/engine
#25174
@CarGuo

Description

@CarGuo

Steps to Reproduce

Multipleflutters Crash in Special Device Mi 11 (Android 11) case by spawnedJNI.nativeShellHolderId < 0

  1. Run multiple_flutters_android in official demo.
  2. click next until show DoubleFlutterActivity .
  3. app crash with spawnedJNI.nativeShellHolderId < 0

ps: Crash Device : Mi 11 (Android 11) ,workaround with Redmi 5 Plus(Android 8.1.0)HuaWei P30pro(Android 10Virtual Device(Android 11)

Debug Image nativeShellHolderId < 0

image

image

More Info

Log

2021-03-17 11:48:37.208 7788-7788/dev.flutter.multipleflutters E/AndroidRuntime: FATAL EXCEPTION: main
    Process: dev.flutter.multipleflutters, PID: 7788
    java.lang.RuntimeException: Unable to start activity ComponentInfo{dev.flutter.multipleflutters/dev.flutter.multipleflutters.DoubleFlutterActivity}: java.lang.IllegalStateException: Failed to spawn new JNI connected shell from existing shell.
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3492)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3652)
        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:85)
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2099)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:233)
        at android.app.ActivityThread.main(ActivityThread.java:7892)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:656)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:967)
     Caused by: java.lang.IllegalStateException: Failed to spawn new JNI connected shell from existing shell.
        at io.flutter.util.Preconditions.checkState(Preconditions.java:52)
        at io.flutter.embedding.engine.FlutterJNI.spawn(FlutterJNI.java:342)
        at io.flutter.embedding.engine.FlutterEngine.spawn(FlutterEngine.java:383)
        at io.flutter.embedding.engine.FlutterEngineGroup.createAndRunEngine(FlutterEngineGroup.java:101)
        at dev.flutter.multipleflutters.EngineBindings.<init>(EngineBindings.kt:45)
        at dev.flutter.multipleflutters.DoubleFlutterActivity$topBindings$2.invoke(DoubleFlutterActivity.kt:17)
        at dev.flutter.multipleflutters.DoubleFlutterActivity$topBindings$2.invoke(DoubleFlutterActivity.kt:15)
        at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74)
        at dev.flutter.multipleflutters.DoubleFlutterActivity.getTopBindings(Unknown Source:2)
        at dev.flutter.multipleflutters.DoubleFlutterActivity.onCreate(DoubleFlutterActivity.kt:58)
        at android.app.Activity.performCreate(Activity.java:8093)
        at android.app.Activity.performCreate(Activity.java:8067)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1309)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3465)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3652) 
        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:85) 
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135) 
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2099) 
        at android.os.Handler.dispatchMessage(Handler.java:106) 
        at android.os.Looper.loop(Looper.java:233) 
        at android.app.ActivityThread.main(ActivityThread.java:7892) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:656) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:967) 
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel unknown, 2.0.2, on macOS 11.2.3 20D91 darwin-x64, locale
    zh-Hans-CN)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
[!] Xcode - develop for iOS and macOS
    ! CocoaPods 1.9.3 out of date (1.10.0 is recommended).
        CocoaPods is used to retrieve the iOS and macOS platform side's plugin
        code that responds to your plugin usage on the Dart side.
        Without CocoaPods, plugins will not work on iOS or macOS.
        For more info, see https://flutter.dev/platform-plugins
      To upgrade see
      https://guides.cocoapods.org/using/getting-started.html#installation for
      instructions.
[✓] Chrome - develop for the web
[✓] Android Studio (version 4.1)
[✓] IntelliJ IDEA Ultimate Edition (version 2018.3.5)
[!] Proxy Configuration
    ! NO_PROXY is not set
[✓] Connected device (3 available)

Activity

pedromassangocode

pedromassangocode commented on Mar 17, 2021

@pedromassangocode

flutter/samples#761
Hi @CarGuo
According to https://github.com/flutter/samples/blob/master/CONTRIBUTING.md#file-an-issue-first the place to file issues related to Flutter examples is in its repository.

Did a quick search and found out that this may be already filled by someone else #78338.
Thank you

added
r: invalidIssue is closed as not valid
and removed
in triagePresently being triaged by the triage team
on Mar 17, 2021
CarGuo

CarGuo commented on Mar 18, 2021

@CarGuo
Author

@pedromassangocode I thinks this issue case by flutter/engine , flutter/samples#761 (comment) mean move flutter/flutter ?

reopened this on Mar 18, 2021
added
a: existing-appsIntegration with existing apps via the add-to-app flow
engineflutter/engine repository. See also e: labels.
platform-androidAndroid applications specifically
c: crashStack traces logged to the console
P2Important issues not at the top of the work list
and removed
r: invalidIssue is closed as not valid
on Mar 18, 2021

11 remaining items

Loading
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

    P2Important issues not at the top of the work lista: existing-appsIntegration with existing apps via the add-to-app flowc: crashStack traces logged to the consoleengineflutter/engine repository. See also e: labels.platform-androidAndroid applications specificallyr: fixedIssue is closed as already fixed in a newer version

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @xster@branjing@CarGuo@gaaclarke@pedromassangocode

      Issue actions

        Multipleflutters Android Failed to spawn new JNI connected shell from existing shell · Issue #78389 · flutter/flutter