alibaba / alibaba/flutter_boost

Android 4.2.1延迟初始化时偶现FlutterEngine did not exist in the FlutterEngineCache:'flutter_boost_default_engine'

Open
#1,833 8 comments 0 reactions 0 assignees View on GitHub
Dominant language
Dart
Stars
7.2k
Forks
1.3k
PR merge metrics
No merged PRs in 30d

Description

因为需要提升App冷启动速度,所以将FlutterBoost初始化放到打开第一个页面之前,但是在上线后偶现了FlutterEngine did not exist in the FlutterEngineCache:'flutter_boost_default_engine'错误,已经排除了多线程问题,调用时序问题,并在open页面之前手动获取了cache engine判空拦截,但是都无效,仍然有几率出现此问题。

java.lang.RuntimeException:Unable to start activity ComponentInfo{com.xxxxx.flutter.FlutterMainActivity}: java.lang.IllegalStateException: The requested cached FlutterEngine did not exist in the FlutterEngineCache: 'flutter_boost_default_engine'
2
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3502)
3
......
4
java.lang.IllegalStateException:The requested cached FlutterEngine did not exist in the FlutterEngineCache: 'flutter_boost_default_engine'
5
io.flutter.embedding.android.FlutterActivityAndFragmentDelegate.void setupFlutterEngine()(FlutterActivityAndFragmentDelegate.java:245)
6
io.flutter.embedding.android.FlutterActivityAndFragmentDelegate.void onAttach(android.content.Context)(FlutterActivityAndFragmentDelegate.java:180)
7
io.flutter.embedding.android.FlutterActivity.void onCreate(android.os.Bundle)(FlutterActivity.java:498)
8
com.idlefish.flutterboost.containers.FlutterBoostActivity.void onCreate(android.os.Bundle)(FlutterBoostActivity.java:54)
9
com.xxxxx.FlutterMainActivity.void onCreate(android.os.Bundle)(FlutterMainActivity.java:32)

有人遇到一样的问题吗?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the reported stack trace in FlutterActivityAndFragmentDelegate.setupFlutterEngine and onAttach, then inspect FlutterBoostActivity.java and FlutterMainActivity.java around the delayed initialization and cached engine lookup. Reproduce the intermittent Android 4.2.1 launch failure if possible and trace when flutter_boost_default_engine is inserted into or read from FlutterEngineCache; done means the cache lookup no longer fails during first-page launch.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, dart
Domain
mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.