主要的代码错误:
getFlutterEngine().getActivityControlSurface().attachToActivity(getActivity(), getLifecycle());
在FlutterBoostActivity和FlutterBoostFragment的类里面,还有FlutterTextureHooker类少了个参数问题
GitHub上找的答案,问题答案
附上代码:
class FakeExclusiveAppComponent implements io.flutter.embedding.android.ExclusiveAppComponent<Activity> {
public void detachFromFlutterEngine() {
// do nothing.
}
public Activity getAppComponent() {
return getActivity();
}
}
private FakeExclusiveAppComponent fakeAppComponent = new FakeExclusiveAppComponent();
替换原来有错误的代码
getFlutterEngine().getActivityControlSurface().attachToActivity(fakeAppComponent, getLifecycle());