Repository navigation
Open
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work listc: fatal crashCrashes that terminate the processCrashes that terminate the processengineflutter/engine related. See also e: labels.flutter/engine related. See also e: labels.found in release: 2.0Found to occur in 2.0Found to occur in 2.0found in release: 2.3Found to occur in 2.3Found to occur in 2.3has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onplatform-androidAndroid applications specificallyAndroid applications specificallyteam-androidOwned by Android platform teamOwned by Android platform teamtriaged-androidTriaged by Android platform teamTriaged by Android platform team
Description
Steps to Reproduce
- Run
flutter create bug. - Override provideFlutterEngine and configureFlutterEngine in MainActivity (
android/app/src/main/kotlin/com/example/bug/MainActivity.kt) to return a persistent engine (and importandroid.content.Contextandio.flutter.embedding.engine.FlutterEngine):override fun provideFlutterEngine(context: Context): FlutterEngine? { return provideEngine(this) } override fun configureFlutterEngine(flutterEngine: FlutterEngine) { // do nothing, because the engine was configured in provideEngine } companion object { var engine: FlutterEngine? = null fun provideEngine(context: Context): FlutterEngine { val eng = engine ?: FlutterEngine(context, emptyArray(), true, false) engine = eng return eng } } - This works as expected. The app can be closed and opened again.
- Now, change the base class of MainActivity from FlutterActivity to FlutterFragmentActivity.
- Open and close the app. FlutterFragmentActivity destroys the engine on detach. Open the app again. It crashes because provideFlutterEngine provided a destroyed engine.
As a workaround, I created a subclass of FlutterEngine with an overridden, empty destroy method.
This is the log when I print the stacktrace inside this overridden destroy function:
05-04 14:53:16.001 30966 30966 D UndestroyableFlutterEngine: Tried to destroy undestroyable engine
05-04 14:53:16.001 30966 30966 D UndestroyableFlutterEngine: java.lang.Exception: Tried to destroy undestroyable engine
05-04 14:53:16.001 30966 30966 D UndestroyableFlutterEngine: at com.example.bug.UndestroyableFlutterEngine.destroy(MainActivity.kt:18)
05-04 14:53:16.001 30966 30966 D UndestroyableFlutterEngine: at io.flutter.embedding.android.FlutterActivityAndFragmentDelegate.onDetach(FlutterActivityAndFragmentDelegate.java:576)
05-04 14:53:16.001 30966 30966 D UndestroyableFlutterEngine: at io.flutter.embedding.android.FlutterFragment.onDetach(FlutterFragment.java:700)
05-04 14:53:16.001 30966 30966 D UndestroyableFlutterEngine: at androidx.fragment.app.Fragment.performDetach(Fragment.java:3229)
05-04 14:53:16.001 30966 30966 D UndestroyableFlutterEngine: at androidx.fragment.app.FragmentStateManager.detach(FragmentStateManager.java:812)
05-04 14:53:16.001 30966 30966 D UndestroyableFlutterEngine: at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:353)
05-04 14:53:16.001 30966 30966 D UndestroyableFlutterEngine: at androidx.fragment.app.SpecialEffectsController$FragmentStateManagerOperation.complete(SpecialEffectsController.java:742)
05-04 14:53:16.001 30966 30966 D UndestroyableFlutterEngine: at androidx.fragment.app.SpecialEffectsController$Operation.cancel(SpecialEffectsController.java:594)
05-04 14:53:16.001 30966 30966 D UndestroyableFlutterEngine: at androidx.fragment.app.SpecialEffectsController.forceCompleteAllOperations(SpecialEffectsController.java:329)
05-04 14:53:16.001 30966 30966 D UndestroyableFlutterEngine: at androidx.fragment.app.FragmentManager.dispatchStateChange(FragmentManager.java:3130)
05-04 14:53:16.001 30966 30966 D UndestroyableFlutterEngine: at androidx.fragment.app.FragmentManager.dispatchDestroy(FragmentManager.java:3105)
05-04 14:53:16.001 30966 30966 D UndestroyableFlutterEngine: at androidx.fragment.app.FragmentController.dispatchDestroy(FragmentController.java:334)
05-04 14:53:16.001 30966 30966 D UndestroyableFlutterEngine: at androidx.fragment.app.FragmentActivity.onDestroy(FragmentActivity.java:330)
05-04 14:53:16.001 30966 30966 D UndestroyableFlutterEngine: at android.app.Activity.performDestroy(Activity.java:7425)
05-04 14:53:16.001 30966 30966 D UndestroyableFlutterEngine: at android.app.Instrumentation.callActivityOnDestroy(Instrumentation.java:1306)
05-04 14:53:16.001 30966 30966 D UndestroyableFlutterEngine: at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:4474)
05-04 14:53:16.001 30966 30966 D UndestroyableFlutterEngine: at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:4507)
05-04 14:53:16.001 30966 30966 D UndestroyableFlutterEngine: at android.app.servertransaction.DestroyActivityItem.execute(DestroyActivityItem.java:39)
05-04 14:53:16.001 30966 30966 D UndestroyableFlutterEngine: at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:145)
05-04 14:53:16.001 30966 30966 D UndestroyableFlutterEngine: at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:70)
05-04 14:53:16.001 30966 30966 D UndestroyableFlutterEngine: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1836)
05-04 14:53:16.001 30966 30966 D UndestroyableFlutterEngine: at android.os.Handler.dispatchMessage(Handler.java:106)
05-04 14:53:16.001 30966 30966 D UndestroyableFlutterEngine: at android.os.Looper.loop(Looper.java:193)
05-04 14:53:16.001 30966 30966 D UndestroyableFlutterEngine: at android.app.ActivityThread.main(ActivityThread.java:6702)
05-04 14:53:16.001 30966 30966 D UndestroyableFlutterEngine: at java.lang.reflect.Method.invoke(Native Method)
05-04 14:53:16.001 30966 30966 D UndestroyableFlutterEngine: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
05-04 14:53:16.001 30966 30966 D UndestroyableFlutterEngine: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:911)
Logs
[ +61 ms] executing: uname -m
[ +34 ms] Exit code 0 from: uname -m
[ ] x86_64
[ +8 ms] executing: [/home/build/flutter/] git -c log.showSignature=false log -n 1 --pretty=format:%H
[ +7 ms] Exit code 0 from: git -c log.showSignature=false log -n 1 --pretty=format:%H
[ ] 0941968447ea8058e56e1479f7e53147149b739e
[ ] executing: [/home/build/flutter/] git tag --points-at 0941968447ea8058e56e1479f7e53147149b739e
[ +15 ms] Exit code 0 from: git tag --points-at 0941968447ea8058e56e1479f7e53147149b739e
[ ] 2.2.0-10.1.pre
[ +7 ms] executing: [/home/build/flutter/] git rev-parse --abbrev-ref --symbolic @{u}
[ +5 ms] Exit code 0 from: git rev-parse --abbrev-ref --symbolic @{u}
[ ] origin/beta
[ ] executing: [/home/build/flutter/] git ls-remote --get-url origin
[ +6 ms] Exit code 0 from: git ls-remote --get-url origin
[ ] https://github.com/flutter/flutter.git
[ +83 ms] executing: [/home/build/flutter/] git rev-parse --abbrev-ref HEAD
[ +7 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD
[ ] beta
[ +58 ms] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[ +3 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[ +60 ms] executing: /home/build/androidsdk/platform-tools/adb devices -l
[ +47 ms] List of devices attached
3080DH2003942436 device usb:1-4 product:Ulefone_Note_7_EEA model:Ulefone_Note_7 device:Ulefone_Note_7 transport_id:19
[ +10 ms] /home/build/androidsdk/platform-tools/adb -s 3080DH2003942436 shell getprop
[ +121 ms] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[ +2 ms] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[ +5 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[ +7 ms] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[ ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[ +86 ms] Skipping pub get: version match.
[ +107 ms] Generating /home/build/bug/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java
[ +53 ms] ro.hardware = mt6580
[ ] ro.build.characteristics = default
[ +38 ms] Initializing file store
[ +9 ms] Skipping target: gen_localizations
[ +6 ms] complete
[ +4 ms] Launching lib/main.dart on Ulefone Note 7 in debug mode...
[ +4 ms] /home/build/flutter/bin/cache/dart-sdk/bin/dart --disable-dart-dev /home/build/flutter/bin/cache/artifacts/engine/linux-x64/frontend_server.dart.snapshot --sdk-root /home/build/flutter/bin/cache/artifacts/engine/common/flutter_patched_sdk/ --incremental --target=flutter --debugger-module-names --experimental-emit-debug-metadata -DFLUTTER_WEB_AUTO_DETECT=true --output-dill /tmp/flutter_tools.BWQGBC/flutter_tool.NMFZRK/app.dill --packages /home/build/bug/.dart_tool/package_config.json -Ddart.vm.profile=false -Ddart.vm.product=false --enable-asserts --track-widget-creation --filesystem-scheme org-dartlang-root --initialize-from-dill build/3c113a45063dc6628e68a4111abcacad.cache.dill.track.dill --enable-experiment=alternative-invalidation-strategy
[ +9 ms] executing: /home/build/androidsdk/build-tools/29.0.2/aapt dump xmltree /home/build/bug/build/app/outputs/flutter-apk/app.apk AndroidManifest.xml
[ +5 ms] Exit code 0 from: /home/build/androidsdk/build-tools/29.0.2/aapt dump xmltree /home/build/bug/build/app/outputs/flutter-apk/app.apk AndroidManifest.xml
[ ] N: android=http://schemas.android.com/apk/res/android
E: manifest (line=2)
A: android:versionCode(0x0101021b)=(type 0x10)0x1
A: android:versionName(0x0101021c)="1.0.0" (Raw: "1.0.0")
A: android:compileSdkVersion(0x01010572)=(type 0x10)0x1e
A: android:compileSdkVersionCodename(0x01010573)="11" (Raw: "11")
A: package="com.example.bug" (Raw: "com.example.bug")
A: platformBuildVersionCode=(type 0x10)0x1e
A: platformBuildVersionName=(type 0x10)0xb
E: uses-sdk (line=7)
A: android:minSdkVersion(0x0101020c)=(type 0x10)0x10
A: android:targetSdkVersion(0x01010270)=(type 0x10)0x1e
E: uses-permission (line=14)
A: android:name(0x01010003)="android.permission.INTERNET" (Raw: "android.permission.INTERNET")
E: application (line=16)
A: android:label(0x01010001)="bug" (Raw: "bug")
A: android:icon(0x01010002)=@0x7f080000
A: android:debuggable(0x0101000f)=(type 0x12)0xffffffff
A: android:appComponentFactory(0x0101057a)="androidx.core.app.CoreComponentFactory" (Raw: "androidx.core.app.CoreComponentFactory")
E: activity (line=21)
A: android:theme(0x01010000)=@0x7f0a0000
A: android:name(0x01010003)="com.example.bug.MainActivity" (Raw: "com.example.bug.MainActivity")
A: android:launchMode(0x0101001d)=(type 0x10)0x1
A: android:configChanges(0x0101001f)=(type 0x11)0x40003fb4
A: android:windowSoftInputMode(0x0101022b)=(type 0x11)0x10
A: android:hardwareAccelerated(0x010102d3)=(type 0x12)0xffffffff
E: meta-data (line=35)
A: android:name(0x01010003)="io.flutter.embedding.android.NormalTheme" (Raw: "io.flutter.embedding.android.NormalTheme")
A: android:resource(0x01010025)=@0x7f0a0001
E: meta-data (line=45)
A: android:name(0x01010003)="io.flutter.embedding.android.SplashScreenDrawable" (Raw: "io.flutter.embedding.android.SplashScreenDrawable")
A: android:resource(0x01010025)=@0x7f040000
E: intent-filter (line=49)
E: action (line=50)
A: android:name(0x01010003)="android.intent.action.MAIN" (Raw: "android.intent.action.MAIN")
E: category (line=52)
A: android:name(0x01010003)="android.intent.category.LAUNCHER" (Raw: "android.intent.category.LAUNCHER")
E: meta-data (line=59)
A: android:name(0x01010003)="flutterEmbedding" (Raw: "flutterEmbedding")
A: android:value(0x01010024)=(type 0x10)0x2
[ +7 ms] executing: /home/build/androidsdk/platform-tools/adb -s 3080DH2003942436 shell -x logcat -v time -t 1
[ +14 ms] <- compile package:bug/main.dart
[ +153 ms] --------- beginning of main
05-04 15:10:01.312 I/libPowerHal( 281): [perfNotifyAppState] foreground:com.android.launcher3, pid:1382
[ +20 ms] executing: /home/build/androidsdk/platform-tools/adb version
[ +8 ms] Android Debug Bridge version 1.0.41
Version 30.0.4-6686687
Installed as /home/build/androidsdk/platform-tools/adb
[ +2 ms] executing: /home/build/androidsdk/platform-tools/adb start-server
[ +10 ms] Building APK
[ +24 ms] Running Gradle task 'assembleDebug'...
[ +4 ms] Using gradle from /home/build/bug/android/gradlew.
[ +20 ms] executing: [/home/build/bug/android/] /home/build/bug/android/gradlew -Pverbose=true -Ptarget-platform=android-arm -Ptarget=/home/build/bug/lib/main.dart -Pdart-defines=RkxVVFRFUl9XRUJfQVVUT19ERVRFQ1Q9dHJ1ZQ== -Pdart-obfuscation=false -Ptrack-widget-creation=true -Ptree-shake-icons=false -Pfilesystem-scheme=org-dartlang-root assembleDebug
[+1065 ms] > Task :app:compileFlutterBuildDebug UP-TO-DATE
[ ] > Task :app:packLibsflutterBuildDebug UP-TO-DATE
[ ] > Task :app:preBuild UP-TO-DATE
[ ] > Task :app:preDebugBuild UP-TO-DATE
[ ] > Task :app:compileDebugAidl NO-SOURCE
[ ] > Task :app:compileDebugRenderscript NO-SOURCE
[ ] > Task :app:generateDebugBuildConfig UP-TO-DATE
[ ] > Task :app:checkDebugAarMetadata UP-TO-DATE
[ ] > Task :app:cleanMergeDebugAssets
[ ] > Task :app:mergeDebugShaders UP-TO-DATE
[ ] > Task :app:compileDebugShaders NO-SOURCE
[ ] > Task :app:generateDebugAssets UP-TO-DATE
[ ] > Task :app:mergeDebugAssets
[ +178 ms] > Task :app:copyFlutterAssetsDebug
[ ] > Task :app:generateDebugResValues UP-TO-DATE
[ ] > Task :app:generateDebugResources UP-TO-DATE
[ ] > Task :app:mergeDebugResources UP-TO-DATE
[ ] > Task :app:createDebugCompatibleScreenManifests UP-TO-DATE
[ ] > Task :app:extractDeepLinksDebug UP-TO-DATE
[ ] > Task :app:processDebugMainManifest UP-TO-DATE
[ ] > Task :app:processDebugManifest UP-TO-DATE
[ ] > Task :app:processDebugManifestForPackage UP-TO-DATE
[ ] > Task :app:processDebugResources UP-TO-DATE
[+1498 ms] > Task :app:compileDebugKotlin
[ ] > Task :app:javaPreCompileDebug UP-TO-DATE
[ ] > Task :app:compileDebugJavaWithJavac UP-TO-DATE
[ ] > Task :app:compileDebugSources UP-TO-DATE
[ ] > Task :app:mergeDebugNativeDebugMetadata NO-SOURCE
[ ] > Task :app:compressDebugAssets UP-TO-DATE
[ ] > Task :app:processDebugJavaRes NO-SOURCE
[ ] > Task :app:mergeDebugJavaResource UP-TO-DATE
[ +98 ms] > Task :app:checkDebugDuplicateClasses UP-TO-DATE
[ +499 ms] > Task :app:dexBuilderDebug
[ +100 ms] > Task :app:desugarDebugFileDependencies UP-TO-DATE
[ ] > Task :app:mergeExtDexDebug UP-TO-DATE
[ ] > Task :app:mergeDebugJniLibFolders UP-TO-DATE
[ ] > Task :app:mergeDebugNativeLibs UP-TO-DATE
[ ] > Task :app:stripDebugDebugSymbols UP-TO-DATE
[ ] > Task :app:validateSigningDebug UP-TO-DATE
[ +998 ms] > Task :app:mergeDexDebug
[ +699 ms] > Task :app:packageDebug
[ +99 ms] > Task :app:assembleDebug
[ ] Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
[ ] Use '--warning-mode all' to show the individual deprecation warnings.
[ ] See https://docs.gradle.org/6.7/userguide/command_line_interface.html#sec:command_line_warnings
[ +37 ms] BUILD SUCCESSFUL in 5s
[ ] 32 actionable tasks: 8 executed, 24 up-to-date
[ +338 ms] Running Gradle task 'assembleDebug'... (completed in 5.6s)
[ +94 ms] calculateSha: LocalDirectory: '/home/build/bug/build/app/outputs/flutter-apk'/app.apk
[+1342 ms] ✓ Built build/app/outputs/flutter-apk/app-debug.apk.
[ +3 ms] executing: /home/build/androidsdk/build-tools/29.0.2/aapt dump xmltree /home/build/bug/build/app/outputs/flutter-apk/app.apk AndroidManifest.xml
[ +14 ms] Exit code 0 from: /home/build/androidsdk/build-tools/29.0.2/aapt dump xmltree /home/build/bug/build/app/outputs/flutter-apk/app.apk AndroidManifest.xml
[ ] N: android=http://schemas.android.com/apk/res/android
E: manifest (line=2)
A: android:versionCode(0x0101021b)=(type 0x10)0x1
A: android:versionName(0x0101021c)="1.0.0" (Raw: "1.0.0")
A: android:compileSdkVersion(0x01010572)=(type 0x10)0x1e
A: android:compileSdkVersionCodename(0x01010573)="11" (Raw: "11")
A: package="com.example.bug" (Raw: "com.example.bug")
A: platformBuildVersionCode=(type 0x10)0x1e
A: platformBuildVersionName=(type 0x10)0xb
E: uses-sdk (line=7)
A: android:minSdkVersion(0x0101020c)=(type 0x10)0x10
A: android:targetSdkVersion(0x01010270)=(type 0x10)0x1e
E: uses-permission (line=14)
A: android:name(0x01010003)="android.permission.INTERNET" (Raw: "android.permission.INTERNET")
E: application (line=16)
A: android:label(0x01010001)="bug" (Raw: "bug")
A: android:icon(0x01010002)=@0x7f080000
A: android:debuggable(0x0101000f)=(type 0x12)0xffffffff
A: android:appComponentFactory(0x0101057a)="androidx.core.app.CoreComponentFactory" (Raw: "androidx.core.app.CoreComponentFactory")
E: activity (line=21)
A: android:theme(0x01010000)=@0x7f0a0000
A: android:name(0x01010003)="com.example.bug.MainActivity" (Raw: "com.example.bug.MainActivity")
A: android:launchMode(0x0101001d)=(type 0x10)0x1
A: android:configChanges(0x0101001f)=(type 0x11)0x40003fb4
A: android:windowSoftInputMode(0x0101022b)=(type 0x11)0x10
A: android:hardwareAccelerated(0x010102d3)=(type 0x12)0xffffffff
E: meta-data (line=35)
A: android:name(0x01010003)="io.flutter.embedding.android.NormalTheme" (Raw: "io.flutter.embedding.android.NormalTheme")
A: android:resource(0x01010025)=@0x7f0a0001
E: meta-data (line=45)
A: android:name(0x01010003)="io.flutter.embedding.android.SplashScreenDrawable" (Raw: "io.flutter.embedding.android.SplashScreenDrawable")
A: android:resource(0x01010025)=@0x7f040000
E: intent-filter (line=49)
E: action (line=50)
A: android:name(0x01010003)="android.intent.action.MAIN" (Raw: "android.intent.action.MAIN")
E: category (line=52)
A: android:name(0x01010003)="android.intent.category.LAUNCHER" (Raw: "android.intent.category.LAUNCHER")
E: meta-data (line=59)
A: android:name(0x01010003)="flutterEmbedding" (Raw: "flutterEmbedding")
A: android:value(0x01010024)=(type 0x10)0x2
[ +1 ms] Stopping app 'app.apk' on Ulefone Note 7.
[ +1 ms] executing: /home/build/androidsdk/platform-tools/adb -s 3080DH2003942436 shell am force-stop com.example.bug
[ +131 ms] executing: /home/build/androidsdk/platform-tools/adb -s 3080DH2003942436 shell pm list packages com.example.bug
[ +131 ms] package:com.example.bug
[ +2 ms] executing: /home/build/androidsdk/platform-tools/adb -s 3080DH2003942436 shell cat /data/local/tmp/sky.com.example.bug.sha1
[ +90 ms] 2022d1e34a675fd230b13422c7469ef5acab7366
[ ] Installing APK.
[ +1 ms] Installing build/app/outputs/flutter-apk/app.apk...
[ ] executing: /home/build/androidsdk/platform-tools/adb -s 3080DH2003942436 install -t -r /home/build/bug/build/app/outputs/flutter-apk/app.apk
[+21078 ms] Performing Streamed Install
Success
[ +1 ms] Installing build/app/outputs/flutter-apk/app.apk... (completed in 21.1s)
[ +5 ms] executing: /home/build/androidsdk/platform-tools/adb -s 3080DH2003942436 shell echo -n ad06f587e754f19a4780ec233d68c216e73137f6 > /data/local/tmp/sky.com.example.bug.sha1
[ +75 ms] executing: /home/build/androidsdk/platform-tools/adb -s 3080DH2003942436 shell -x logcat -v time -t 1
[ +202 ms] --------- beginning of main
05-04 15:10:30.225 E/libc (32559): Access denied finding property "persist.vendor.sys.activitylog"
[ +32 ms] executing: /home/build/androidsdk/platform-tools/adb -s 3080DH2003942436 shell am start -a android.intent.action.RUN -f 0x20000000 --ez enable-background-compilation true --ez enable-dart-profiling true --ez enable-checked-mode true --ez verify-entry-points true com.example.bug/com.example.bug.MainActivity
[ +599 ms] Starting: Intent { act=android.intent.action.RUN flg=0x20000000 cmp=com.example.bug/.MainActivity (has extras) }
[ ] Waiting for observatory port to be available...
[+7320 ms] Observatory URL on device: http://127.0.0.1:46501/G0VO9AFqo-o=/
[ +5 ms] executing: /home/build/androidsdk/platform-tools/adb -s 3080DH2003942436 forward tcp:0 tcp:46501
[ +17 ms] 36889
[ ] Forwarded host port 36889 to device port 46501 for Observatory
[ +7 ms] Caching compiled dill
[ +47 ms] Connecting to service protocol: http://127.0.0.1:36889/G0VO9AFqo-o=/
[+1704 ms] Launching a Dart Developer Service (DDS) instance at http://127.0.0.1:0, connecting to VM service at http://127.0.0.1:36889/G0VO9AFqo-o=/.
[ +536 ms] DDS is listening at http://127.0.0.1:35975/MBUsSyD5ERQ=/.
[ +105 ms] Successfully connected to service protocol: http://127.0.0.1:36889/G0VO9AFqo-o=/
[ +242 ms] DevFS: Creating new filesystem on the device (null)
[ +79 ms] I/OpenGLRenderer(32603): Davey! duration=3675ms; Flags=1, IntendedVsync=251814380459280, Vsync=251817897222676, OldestInputEvent=9223372036854775807, NewestInputEvent=0, HandleInputStart=251817910132742, AnimationStart=251817910691742, PerformTraversalsStart=251817910721972, DrawStart=251817974172363, SyncQueued=251818004464751, SyncStart=251818014994521, IssueDrawCommandsStart=251818015719752, SwapBuffers=251818058947756, FrameCompleted=251818066355911, DequeueBufferDuration=0, QueueBufferDuration=1107000,
[ +654 ms] DevFS: Created new filesystem on the device (file:///data/user/0/com.example.bug/code_cache/bugTRTZIK/bug/)
[ +2 ms] Updating assets
[ +73 ms] Syncing files to device Ulefone Note 7...
[ +1 ms] <- reset
[ ] Compiling dart to kernel with 0 updated files
[ +2 ms] <- recompile package:bug/main.dart 1c05e3fa-5a5f-483b-8ea3-b625f8c4d56a
[ ] <- 1c05e3fa-5a5f-483b-8ea3-b625f8c4d56a
[ +102 ms] Updating files.
[ ] DevFS: Sync finished
[ +1 ms] Syncing files to device Ulefone Note 7... (completed in 107ms)
[ ] Synced 0.0MB.
[ ] <- accept
[ +54 ms] Connected to _flutterView/0xaa7c7010.
[ +3 ms] Flutter run key commands.
[ +2 ms] r Hot reload. 🔥🔥🔥
[ +1 ms] R Hot restart.
[ ] h Repeat this help message.
[ ] d Detach (terminate "flutter run" but leave application running).
[ ] c Clear the screen
[ ] q Quit (terminate the application on the device).
[ ] 💪 Running with sound null safety 💪
[ ] An Observatory debugger and profiler on Ulefone Note 7 is available at: http://127.0.0.1:35975/MBUsSyD5ERQ=/
[ ] The Flutter DevTools debugger and profiler on Ulefone Note 7 is available at: http://127.0.0.1:9100?uri=http%3A%2F%2F127.0.0.1%3A35975%2FMBUsSyD5ERQ%3D%2F
[+16966 ms] D/Surface (32603): Surface::disconnect(this=0x998aa000,api=1)
[ ] D/Surface (32603): Surface::disconnect(this=0x998aa000,api=-1)
[ +21 ms] V/PhoneWindow(32603): DecorView setVisiblity: visibility = 4, Parent = android.view.ViewRootImpl@a4c6e69, this = DecorView@a6530ee[MainActivity]
[ +78 ms] E/libEGL (32603): call to OpenGL ES API with no current context (logged once per thread)
[ +19 ms] D/Surface (32603): Surface::disconnect(this=0x9990d000,api=1)
[ +16 ms] D/View (32603): [Warning] assignParent to null: this = DecorView@a6530ee[MainActivity]
[+4201 ms] W/ActivityThread(32603): handleWindowVisibility: no activity for token android.os.BinderProxy@dbfbe4e
[ +255 ms] W/FlutterJNI(32603): Tried to send a platform message to Flutter, but FlutterJNI was detached from native C++. Could not send. Channel: flutter/textinput. Response ID: 0
[ +11 ms] D/AndroidRuntime(32603): Shutting down VM
[ +19 ms] E/AndroidRuntime(32603): FATAL EXCEPTION: main
[ +6 ms] E/AndroidRuntime(32603): Process: com.example.bug, PID: 32603
[ +3 ms] E/AndroidRuntime(32603): java.lang.RuntimeException: Cannot execute operation because FlutterJNI is not attached to native.
[ +1 ms] E/AndroidRuntime(32603): at io.flutter.embedding.engine.FlutterJNI.ensureAttachedToNative(FlutterJNI.java:385)
[ ] E/AndroidRuntime(32603): at io.flutter.embedding.engine.FlutterJNI.setSemanticsEnabled(FlutterJNI.java:686)
[ +1 ms] E/AndroidRuntime(32603): at io.flutter.embedding.engine.systemchannels.AccessibilityChannel.onAndroidAccessibilityDisabled(AccessibilityChannel.java:113)
[ ] E/AndroidRuntime(32603): at io.flutter.view.AccessibilityBridge$2.onAccessibilityStateChanged(AccessibilityBridge.java:295)
[ +1 ms] E/AndroidRuntime(32603): at io.flutter.view.AccessibilityBridge.<init>(AccessibilityBridge.java:383)
[ ] E/AndroidRuntime(32603): at io.flutter.view.AccessibilityBridge.<init>(AccessibilityBridge.java:353)
[ ] E/AndroidRuntime(32603): at io.flutter.embedding.android.FlutterView.attachToFlutterEngine(FlutterView.java:907)
[ ] E/AndroidRuntime(32603): at io.flutter.embedding.android.FlutterActivityAndFragmentDelegate.onCreateView(FlutterActivityAndFragmentDelegate.java:304)
[ ] E/AndroidRuntime(32603): at io.flutter.embedding.android.FlutterFragment.onCreateView(FlutterFragment.java:622)
[ +1 ms] E/AndroidRuntime(32603): at androidx.fragment.app.Fragment.performCreateView(Fragment.java:2600)
[ ] E/AndroidRuntime(32603): at androidx.fragment.app.FragmentManagerImpl.moveToState(FragmentManagerImpl.java:881)
[ ] E/AndroidRuntime(32603): at androidx.fragment.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManagerImpl.java:1238)
[ ] E/AndroidRuntime(32603): at androidx.fragment.app.FragmentManagerImpl.moveToState(FragmentManagerImpl.java:1303)
[ ] E/AndroidRuntime(32603): at androidx.fragment.app.BackStackRecord.executeOps(BackStackRecord.java:439)
[ ] E/AndroidRuntime(32603): at androidx.fragment.app.FragmentManagerImpl.executeOps(FragmentManagerImpl.java:2079)
[ ] E/AndroidRuntime(32603): at androidx.fragment.app.FragmentManagerImpl.executeOpsTogether(FragmentManagerImpl.java:1869)
[ ] E/AndroidRuntime(32603): at androidx.fragment.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(FragmentManagerImpl.java:1824)
[ ] E/AndroidRuntime(32603): at androidx.fragment.app.FragmentManagerImpl.execPendingActions(FragmentManagerImpl.java:1727)
[ ] E/AndroidRuntime(32603): at androidx.fragment.app.FragmentManagerImpl.dispatchStateChange(FragmentManagerImpl.java:2663)
[ ] E/AndroidRuntime(32603): at androidx.fragment.app.FragmentManagerImpl.dispatchActivityCreated(FragmentManagerImpl.java:2613)
[ ] E/AndroidRuntime(32603): at androidx.fragment.app.FragmentController.dispatchActivityCreated(FragmentController.java:246)
[ ] E/AndroidRuntime(32603): at androidx.fragment.app.FragmentActivity.onStart(FragmentActivity.java:542)
[ ] E/AndroidRuntime(32603): at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1391)
[ ] E/AndroidRuntime(32603): at android.app.Activity.performStart(Activity.java:7187)
[ ] E/AndroidRuntime(32603): at android.app.ActivityThread.handleStartActivity(ActivityThread.java:2968)
[ ] E/AndroidRuntime(32603): at android.app.servertransaction.TransactionExecutor.performLifecycleSequence(TransactionExecutor.java:180)
[ ] E/AndroidRuntime(32603): at android.app.servertransaction.TransactionExecutor.cycleToPath(TransactionExecutor.java:165)
[ ] E/AndroidRuntime(32603): at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:142)
[ ] E/AndroidRuntime(32603): at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:70)
[ ] E/AndroidRuntime(32603): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1836)
[ ] E/AndroidRuntime(32603): at android.os.Handler.dispatchMessage(Handler.java:106)
[ ] E/AndroidRuntime(32603): at android.os.Looper.loop(Looper.java:193)
[ ] E/AndroidRuntime(32603): at android.app.ActivityThread.main(ActivityThread.java:6702)
[ ] E/AndroidRuntime(32603): at java.lang.reflect.Method.invoke(Native Method)
[ ] E/AndroidRuntime(32603): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
[ ] E/AndroidRuntime(32603): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:911)
[+5152 ms] Service protocol connection closed.
[ ] Lost connection to device.
[ +2 ms] executing: /home/build/androidsdk/platform-tools/adb -s 3080DH2003942436 forward --list
[ +8 ms] Exit code 0 from: /home/build/androidsdk/platform-tools/adb -s 3080DH2003942436 forward --list
[ ] 3080DH2003942436 tcp:40959 tcp:45085
3080DH2003942436 tcp:33225 tcp:44475
3080DH2003942436 tcp:33783 tcp:35835
3080DH2003942436 tcp:38761 tcp:44507
3080DH2003942436 tcp:32953 tcp:37329
3080DH2003942436 tcp:36889 tcp:46501
[ +1 ms] executing: /home/build/androidsdk/platform-tools/adb -s 3080DH2003942436 forward --remove tcp:40959
[ +7 ms] executing: /home/build/androidsdk/platform-tools/adb -s 3080DH2003942436 forward --remove tcp:33225
[ +7 ms] executing: /home/build/androidsdk/platform-tools/adb -s 3080DH2003942436 forward --remove tcp:33783
[ +7 ms] executing: /home/build/androidsdk/platform-tools/adb -s 3080DH2003942436 forward --remove tcp:38761
[ +7 ms] executing: /home/build/androidsdk/platform-tools/adb -s 3080DH2003942436 forward --remove tcp:32953
[ +7 ms] executing: /home/build/androidsdk/platform-tools/adb -s 3080DH2003942436 forward --remove tcp:36889
[ +9 ms] DevFS: Deleting filesystem on the device (file:///data/user/0/com.example.bug/code_cache/bugTRTZIK/bug/)
[ +257 ms] Ignored error while cleaning up DevFS: TimeoutException after 0:00:00.250000: Future not completed
[ +5 ms] executing: /home/build/androidsdk/platform-tools/adb -s 3080DH2003942436 forward --list
[ +24 ms] Exit code 0 from: /home/build/androidsdk/platform-tools/adb -s 3080DH2003942436 forward --list
[ +5 ms] "flutter run" took 68,415ms.
[ +133 ms] ensureAnalyticsSent: 128ms
[ +7 ms] Running shutdown hooks
[ +1 ms] Shutdown hooks complete
[ +2 ms] exiting with code 0
Analyzing bug...
No issues found! (ran in 15.4s)
[✓] Flutter (Channel beta, 2.2.0-10.1.pre, on Linux, locale en_US.utf8)
• Flutter version 2.2.0-10.1.pre at /home/build/flutter
• Framework revision 0941968447 (3 weeks ago), 2021-04-15 12:01:02 -0700
• Engine revision d2a2e93510
• Dart version 2.13.0 (build 2.13.0-211.6.beta)
[!] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
• Android SDK at /home/build/androidsdk
• Platform android-30, build-tools 29.0.2
• ANDROID_HOME = /home/build/androidsdk
• ANDROID_SDK_ROOT = /home/build/androidsdk
• Java binary at: /usr/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_292-b10)
✗ Android license status unknown.
Run `flutter doctor --android-licenses` to accept the SDK licenses.
See https://flutter.dev/docs/get-started/install/linux#android-setup for more details.
[✗] Chrome - develop for the web (Cannot find Chrome executable at google-chrome)
! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.
[✓] Linux toolchain - develop for Linux desktop
• clang version 11.1.0
• cmake version 3.20.1
• ninja version 1.10.2
• pkg-config version 1.7.3
[!] Android Studio (not installed)
• Android Studio not found; download from https://developer.android.com/studio/index.html
(or visit https://flutter.dev/docs/get-started/install/linux#android-setup for detailed instructions).
[✓] Connected device (2 available)
• Ulefone Note 7 (mobile) • 3080DH2003942436 • android-arm • Android 9 (API 28)
• Linux (desktop) • linux • linux-x64 • Linux
! Doctor found issues in 3 categories.
Reacted by Pedro Massango, azack, tianjyan, Hadi and Tamás Barta
Reacted by Marcus
Metadata
Metadata
Assignees
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work listc: fatal crashCrashes that terminate the processCrashes that terminate the processengineflutter/engine related. See also e: labels.flutter/engine related. See also e: labels.found in release: 2.0Found to occur in 2.0Found to occur in 2.0found in release: 2.3Found to occur in 2.3Found to occur in 2.3has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onplatform-androidAndroid applications specificallyAndroid applications specificallyteam-androidOwned by Android platform teamOwned by Android platform teamtriaged-androidTriaged by Android platform teamTriaged by Android platform team
Activity
lukaslihotzki commentedon May 4, 2021
Also, adding
override fun shouldDestroyEngineWithHost(): Boolean = falsein MainActivity (android/app/src/main/kotlin/com/example/bug/MainActivity.kt) does not solve this issue.TahaTesser commentedon May 5, 2021
Hi @lukaslihotzki
I just tried the reproduce the issue following steps, made the changes, when closing the app and launching it again, it didn't crash on emulator or device, also tried release mode.
code sample
flutter doctor -v
lukaslihotzki commentedon May 5, 2021
Hi @TahaTesser
The app needs to be closed with the back button to reproduce this issue. Not just with the home button, and not swiping it up in multitasking view. I should have said this in the issue. I can reproduce this issue in flutter stable and beta.
Bubu commentedon May 5, 2021
I can reproduce this with the provided steps.
TahaTesser commentedon May 6, 2021
Hi @lukaslihotzki
I was closing it from the recent menu, pressing the back button does reproduce the issue, thanks
code sample
logs
flutter doctor -v
2 remaining items
jason-simmons commentedon May 19, 2021
FlutterFragmentis destroying the engine because the fragment'sARG_DESTROY_ENGINE_WITH_FRAGMENTparameter is true by default(https://github.com/flutter/engine/blob/master/shell/platform/android/io/flutter/embedding/android/FlutterFragment.java#L121)
To avoid destroying the engine, use a
CachedEngineFragmentBuilder(https://api.flutter.dev/javadoc/io/flutter/embedding/android/FlutterFragment.CachedEngineFragmentBuilder.html)For a simple way to use this, see
FlutterEngineCacheandFlutterFragment.withCachedEngine(https://api.flutter.dev/javadoc/io/flutter/embedding/android/FlutterFragment.html)brucemckayone commentedon Mar 11, 2022
Would it be possible for you to provide a code sample, as I have no Android experience only flutter, and this stuff is out knowledge as of now.
i am having conflicts with flutter_stripe
shoaibkhalid-int commentedon Jan 9, 2024
I can reproduce it with back button as mentioned above.
any work around?
ShoaibKakal commentedon Jan 9, 2024
I'm able to successfully resolve this error using
getCachedEngineId()You need to override
getCachedEngineId()and return engine id like below:tianjyan commentedon Feb 5, 2024
How is this issue going? I have the same issue when I use
FlutterEngineGroupandFlutterFragmentActivity.Here are my codes:
shoaibkhalid-int commentedon Feb 5, 2024
you should override
getCachedEngineId().tianjyan commentedon Feb 5, 2024
Thanks for your response, I tried to override
getCachedEngineId()and return a static string, but a crash happened when I launched the Activity, it told me that the requested cached FlutterEngine did not exist with the static name.ShoaibKakal commentedon Feb 5, 2024
I see you're not using
FlutterEngineCache. You should first put your engine in cache with a unique id and then return that id fromgetCachedEngineId().Solution 2:
I would highly recommend you to prewarm your engine in BaseApplication or in any root class to avoid other issues like engine not found. This is because you're trying to access an engine which is not yet setup as prewarming engine takes time.
Hope it will help you.
tianjyan commentedon Feb 6, 2024
@ShoaibKakal I got you. Thanks a lot.
itaishalom commentedon Mar 17, 2025
Getting this stack trace when app is closed with back button and then reopened, is it related?
java.lang.RuntimeException - Cannot execute operation because FlutterJNI is not attached to native.
io.flutter.embedding.engine.FlutterJNI.ensureAttachedToNative (Unknown Source:9)
io.flutter.embedding.engine.FlutterJNI.dispatchPointerDataPacket (Unknown Source:3)
io.flutter.embedding.engine.renderer.FlutterRenderer.dispatchPointerDataPacket (Unknown Source:2)
io.flutter.embedding.android.AndroidTouchProcessor.onTouchEvent (SourceFile:13)
io.flutter.embedding.android.AndroidTouchProcessor.onTouchEvent (SourceFile:1)
io.flutter.embedding.android.FlutterView.onTouchEvent (Unknown Source:16)
android.view.View.dispatchTouchEvent (View.java:15076)
relaxedSoul commentedon Sep 1, 2025
@itaishalom I had the similar exception, when the following happened:
Once the activity is closed, the engine's dart executor will be destroyed and the FlutterJNI will be detached.
So, this is kind of related - the logs you shared is one of the signs that the engine you expected to use was destroyed.
--
As it is noticed above, please override these methods in MainActivity as well:
getCachedEngineId(),provideFlutterEngine(context)(I assume it is already overriden)There are comments above with details regarding the reason