Repository: flutter
Issue: Crash when using FlutterFragment: pc 0004a0d0 /system/lib/libc.so (tgkill+12)
Labels: platform-android,engine,a: existing-apps,a: release,P2,c: fatal crash,team-android,triaged-android

## Steps to Reproduce
My app needs to show the main program, and at the same time, show a Fragment suspension layer on the main program (click a button) to do other things. (It may be possible to close this Fragment after the next click will need to show it again). So I'm using FlutterFragment and FlutterEngine in my app. It runs perfectly. 
But when I released him to the App Store. Count a large number of FlutterJNI errors. And I switched several Flutter versions, tried the latest versions of master and dev branches, and didn't solve the problem. I look forward to your suggestions.

## Log 
<details>
  <summary>crash logs</summary>

15. ui(2050)
SIGABRT

1 #00 pc 0004a0d0 /system/lib/libc.so (tgkill+12)
2 #01 pc 00047863 /system/lib/libc.so (pthread_kill+34)
3 #02 pc 0001d8b5 /system/lib/libc.so (raise+10)
4 #03 pc 00019401 /system/lib/libc.so
5 #04 pc 00017048 /system/lib/libc.so (abort+4)
6 #05 pc 002bcb45 /data/app/cc.yourdream.sunmi-1/lib/arm/libflutter.so
7 #06 pc 00330e9f /data/app/cc.yourdream.sunmi-1/lib/arm/libflutter.so
8 #07 pc 00366529 /data/app/cc.yourdream.sunmi-1/lib/arm/libflutter.so
9 #08 pc 004b1c2b /data/app/cc.yourdream.sunmi-1/lib/arm/libflutter.so
10 #09 pc 00326fdb /data/app/cc.yourdream.sunmi-1/lib/arm/libflutter.so
11 #10 pc 00326647 /data/app/cc.yourdream.sunmi-1/lib/arm/libflutter.so
12 #11 pc 00326241 /data/app/cc.yourdream.sunmi-1/lib/arm/libflutter.so
13 #12 pc 003266db /data/app/cc.yourdream.sunmi-1/lib/arm/libflutter.so
14 #13 pc 00536657 /data/app/cc.yourdream.sunmi-1/lib/arm/libflutter.so
15 #14 pc 0002e7c5 /data/app/cc.yourdream.sunmi-1/lib/arm/libflutter.so
16 #15 pc 0002e85d /data/app/cc.yourdream.sunmi-1/lib/arm/libflutter.so
17 #16 pc 00036aed /data/app/cc.yourdream.sunmi-1/lib/arm/libflutter.so
18 #17 pc 00035d99 /data/app/cc.yourdream.sunmi-1/lib/arm/libflutter.so
19 #18 pc 00035bd3 /data/app/cc.yourdream.sunmi-1/lib/arm/libflutter.so
20 #19 pc 0003f5f7 /data/app/cc.yourdream.sunmi-1/lib/arm/libflutter.so
21 #20 pc 00012e19 /data/app/cc.yourdream.sunmi-1/lib/arm/libflutter.so
22 #21 pc 00016439 /data/app/cc.yourdream.sunmi-1/lib/arm/libflutter.so
23 #22 pc 00011fcb /system/lib/libutils.so (_ZN7android6Looper9pollInnerEi+614) [armeabi-v7a::0f09fea55a38a156f392477a1473c6c2]
24 #23 pc 00011cd7 /system/lib/libutils.so (_ZN7android6Looper8pollOnceEiPiS1_PPv+26) [armeabi-v7a::0f09fea55a38a156f392477a1473c6c2]
25 #24 pc 0000b683 /system/lib/libandroid.so (ALooper_pollOnce+50) [armeabi-v7a::d562df092efe0e1c76d8fb4c07ab5cf3]
26 #25 pc 000163f1 /data/app/cc.yourdream.sunmi-1/lib/arm/libflutter.so
27 #26 pc 00012d93 /data/app/cc.yourdream.sunmi-1/lib/arm/libflutter.so
28 #27 pc 00014c55 /data/app/cc.yourdream.sunmi-1/lib/arm/libflutter.so
29 #28 pc 00047333 /system/lib/libc.so (_ZL15__pthread_startPv+22) [armeabi-v7a::32626d22742e2934071679e817c6ec99]
30 #29 pc 00019e5d /system/lib/libc.so (__start_thread+6) [armeabi-v7a::32626d22742e2934071679e817c6ec99]
31 java:
32 [Failed to get Java stack]

#main(1)
io.flutter.embedding.engine.FlutterJNI.nativeSurfaceCreated(Native Method)
2 io.flutter.embedding.engine.FlutterJNI.onSurfaceCreated(FlutterJNI.java:321)
3 io.flutter.embedding.engine.renderer.FlutterRenderer.startRenderingToSurface(FlutterRenderer.java:183)
4 io.flutter.embedding.android.FlutterSurfaceView.connectSurfaceToRenderer(FlutterSurfaceView.java:234)
5 io.flutter.embedding.android.FlutterSurfaceView.access$200(FlutterSurfaceView.java:34)
6 io.flutter.embedding.android.FlutterSurfaceView$1.surfaceCreated(FlutterSurfaceView.java:53)
7 android.view.SurfaceView.updateWindow(SurfaceView.java:618)
8 android.view.SurfaceView$3.onPreDraw(SurfaceView.java:161)
9 android.view.ViewTreeObserver.dispatchOnPreDraw(ViewTreeObserver.java:944)
10 android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2219)
11 android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1268)
12 android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6356)
13 android.view.Choreographer$CallbackRecord.run(Choreographer.java:874)
14 android.view.Choreographer.doCallbacks(Choreographer.java:686)
15 android.view.Choreographer.doFrame(Choreographer.java:621)
16 android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:860)
17 android.os.Handler.handleCallback(Handler.java:756)
18 android.os.Handler.dispatchMessage(Handler.java:96)
19 android.os.Looper.loop(Looper.java:154)
20 android.app.ActivityThread.main(ActivityThread.java:6141)
21 java.lang.reflect.Method.invoke(Native Method)
22 com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:912)
23 com.android.internal.os.ZygoteInit.main(ZygoteInit.java:802)

</details>


## Flutter doctor

<details>
  <summary>Flutter doctor</summary>

  flutter doctor Doctor summary (to see all details, run flutter doctor -v):
  [✓] Flutter (Channel master, 1.22.0-10.0.pre.107, on Mac OS X 10.15.6 19G2021, locale zh-Hans-CN)
  [✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
  [✓] Xcode - develop for iOS and macOS (Xcode 12.0)
  [✓] Android Studio (version 4.0)
  [✓] Connected device (1 available)

</details>