Skip to content

Cannot create a Flutter macOS app extension: 'FlutterEngineInitialize' returned 'kInvalidArguments'. The assets path in the Flutter project arguments was missing. #124755

@jmagman

Description

@jmagman

After flutter/engine#41011 started publishing artifacts I tried to make a macOS Share extension, but on launch the engine will not start:

Failed to find path for "flutter_assets"
embedder.cc (1601): 'FlutterEngineInitialize' returned 'kInvalidArguments'. The assets path in the Flutter project arguments was missing.

The App.framework bundle isn't found from the appex bundle. Suspect macOS needs similar logic to this:

if ([mainBundle.bundleURL.pathExtension isEqualToString:@"appex"]) {

https://github.com/flutter/engine/pull/40332/files#diff-aff27bb72cc390eb03f0b733e1fa490102e311ffac10e8e09e8245e582484220R84

Here:
https://github.com/flutter/engine/blob/b50954c3f7d6dca6702ad843aa0fa7a51c774323/shell/platform/darwin/macos/framework/Source/FlutterDartProject.mm#L32

See also https://github.com/flutter/engine/pull/37421/files#diff-8646d867d6b502217ca15af1cfd042f7148929efb68e1f28d796351a80594832R38 which is changing this same spot.

Steps to reproduce

  1. Create Flutter project
$ flutter create test_create
$ cd test_create
$ flutter build macos --config-only
$ open macos/Runner.xcworkspace/
  1. Add a new Share target and Activate it.

Screenshot 2023-04-12 at 6 11 03 PM

Screenshot 2023-04-12 at 6 11 26 PM

  1. In test_create/macos/FlutterShare/Info.plist change NSExtensionPrincipalClass to FlutterViewController.

Screenshot 2023-04-12 at 6 12 42 PM

  1. In Xcode set a signing Team and set the Signing Certificate to Development for both the Runner and new FlutterShare targets. These app extensions fail with codesign errors if they are ad-hoc signed.

Screenshot 2023-04-12 at 6 09 24 PM

  1. In the FlutterShare target build settings add -framework FlutterMacOS to Other Linker Flags

Screenshot 2023-04-12 at 6 18 00 PM

  1. Run the FlutterShare target in Safari

Screenshot 2023-04-12 at 6 13 09 PM

  1. In the top right corner of Safari under the Share menu choose FlutterShare

Screenshot 2023-04-12 at 6 15 21 PM

Results

In Xcode console:

2023-04-12 18:17:45.807583-0700 FlutterShare[28145:12591166] Failed to find path for "flutter_assets"
2023-04-12 18:17:45.808568-0700 FlutterShare[28145:12591166] Failed to find path for "flutter_assets"
embedder.cc (1601): 'FlutterEngineInitialize' returned 'kInvalidArguments'. The assets path in the Flutter project arguments was missing.
2023-04-12 18:17:45.808903-0700 FlutterShare[28145:12591166] Failed to initialize Flutter engine: error 2

and no UI launches.

cc @cyanglaz part of #124290

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Issues that are less important to the Flutter projectengineflutter/engine related. See also e: labels.platform-macBuilding on or for macOS specificallyteam-engineOwned by Engine teamtriaged-engineTriaged by Engine team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions