Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 3e5e7a4

Browse files
committed
fixed the entrypoint test
1 parent a65561d commit 3e5e7a4

File tree

1 file changed

+17
-12
lines changed

1 file changed

+17
-12
lines changed

shell/platform/android/io/flutter/embedding/android/FlutterActivityAndFragmentDelegate.java

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,18 @@ void onAttach(@NonNull Context context) {
228228
return activity;
229229
}
230230

231+
private FlutterEngineGroup.Options addEntrypointOptions(FlutterEngineGroup.Options options) {
232+
String appBundlePathOverride = host.getAppBundlePath();
233+
if (appBundlePathOverride == null || appBundlePathOverride.isEmpty()) {
234+
appBundlePathOverride = FlutterInjector.instance().flutterLoader().findAppBundlePath();
235+
}
236+
237+
DartExecutor.DartEntrypoint dartEntrypoint =
238+
new DartExecutor.DartEntrypoint(
239+
appBundlePathOverride, host.getDartEntrypointFunctionName());
240+
return options.setDartEntrypoint(dartEntrypoint).setInitialRoute(host.getInitialRoute());
241+
}
242+
231243
/**
232244
* Obtains a reference to a FlutterEngine to back this delegate and its {@code host}.
233245
*
@@ -285,17 +297,9 @@ void onAttach(@NonNull Context context) {
285297
+ "'");
286298
}
287299

288-
String appBundlePathOverride = host.getAppBundlePath();
289-
if (appBundlePathOverride == null || appBundlePathOverride.isEmpty()) {
290-
appBundlePathOverride = FlutterInjector.instance().flutterLoader().findAppBundlePath();
291-
}
292-
293-
DartExecutor.DartEntrypoint dartEntrypoint =
294-
new DartExecutor.DartEntrypoint(
295-
appBundlePathOverride, host.getDartEntrypointFunctionName());
296300
flutterEngine =
297301
flutterEngineGroup.createAndRunEngine(
298-
host.getContext(), dartEntrypoint, host.getInitialRoute());
302+
addEntrypointOptions(new FlutterEngineGroup.Options(host.getContext())));
299303
isFlutterEngineFromHost = false;
300304
return;
301305
}
@@ -313,9 +317,10 @@ void onAttach(@NonNull Context context) {
313317
: engineGroup;
314318
flutterEngine =
315319
group.createAndRunEngine(
316-
new FlutterEngineGroup.Options(host.getContext())
317-
.setAutomaticallyRegisterPlugins(false)
318-
.setWaitForRestorationData(host.shouldRestoreAndSaveState()));
320+
addEntrypointOptions(
321+
new FlutterEngineGroup.Options(host.getContext())
322+
.setAutomaticallyRegisterPlugins(false)
323+
.setWaitForRestorationData(host.shouldRestoreAndSaveState())));
319324
isFlutterEngineFromHost = false;
320325
}
321326

0 commit comments

Comments
 (0)