Skip to content

[SPM] Identity mismatch error when plugin root directory name differs from Dart package name #186881

Closed

Description

@juan-campuzano

Steps to reproduce

  1. Have a Flutter plugin whose repository/folder name differs from its Dart package name — e.g., repo dir is NUXXXXX_DEVICE_PLUGIN_Lib, Dart package name is device_plugin.
  2. Set up SPM support per the guide (Package.swift with name: "device_plugin")).
  3. In the example app's pubspec.yaml, reference the plugin as a local path dependency:
  4. Enable SPM and run the example app:
flutter config --enable-swift-package-manager
flutter run

Actual results

Expected behavior

SPM resolves the plugin package successfully and the app builds.

Actual results

Adding Swift Package Manager integration...
An error occurred when adding Swift Package Manager integration:
  Error: Unable to get Xcode project information:
xcodebuild: error: Could not resolve package dependencies:
  unable to override package 'device_plugin' because its identity
  'nuxxxxx_security_device_plugin_lib' doesn't match override's identity
  (directory name) 'device_plugin'

Logs

Logs
flutter run
Launching lib/main.dart on iPhone 16e in debug mode...
Adding Swift Package Manager integration...                      1,614ms
An error occurred when adding Swift Package Manager integration:
  Error: Unable to get Xcode project information:
 2026-05-21 08:49:47.845 xcodebuild[12882:2710100] Writing error result bundle to
 /var/folders/mp/h6npmgjs46sbd6q6c_v1q1q80000gr/T/ResultBundle_2026-21-05_08-49-0
 047.xcresult
xcodebuild: error: Could not resolve package dependencies:
  unable to override package 'device_plugin' because its identity
  'nuxxxxx_security_device_plugin_lib' doesn't match override's identity
  (directory name) 'device_plugin'
  public headers ("include") directory path for 'device_plugin' is invalid or
  not contained in the target
  public headers ("include") directory path for 'device_plugin' is invalid or
  not contained in the target



Swift Package Manager is currently an experimental feature, please file a bug at
  https://github.com/flutter/flutter/issues/new?template=01_activation.yml 
Consider including a copy of the following files in your bug report:
  ios/Runner.xcodeproj/project.pbxproj
  ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme (or the scheme for
  the flavor used)

To add Swift Package Manager integration manually, please use the following
instructions:
https://docs.flutter.dev/to/add-swift-package-manager-manually

You can also disable Swift Package Manager for the project by following these
instructions:
  https://docs.flutter.dev/packages-and-plugins/swift-package-manager/for-app-dev
  elopers#how-to-turn-off-swift-package-manager
Disabling Swift Package Manager will not be allowed in a future version of
Flutter.


Error launching application on iPhone 16e.

Flutter Doctor output

Doctor output
flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.44.0, on macOS 26.1 25B78 darwin-arm64, locale en-CO)
[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 26.3)
[✓] Chrome - develop for the web
[✓] Connected device (5 available)
[✓] Network resources

• No issues found!

Activity

  1. added
    in triagePresently being triaged by the triage team
    platform-iosiOS applications specifically
    toolAffects the "flutter" command-line tool. See also t: labels.
    t: xcode"xcodebuild" on iOS and general Xcode project management
    has reproducible stepsThe issue has been confirmed reproducible and is ready to work on
    team-iosOwned by iOS platform team
    and removed
    in triagePresently being triaged by the triage team
    on May 21, 2026
  2. mbcorona commented on May 21, 2026

    @mbcorona
    Member

    Hi @juan-campuzano , thanks for reporting, routing to team-ios for investigation.

  3. added
    P2Important issues not at the top of the work list
    triaged-iosTriaged by iOS platform team
    on May 21, 2026
  4. vashworth commented on Jun 4, 2026

    @vashworth
    Contributor

    @juan-campuzano Can you provide an example directory structure of this?

  5. juan-campuzano commented on Jun 4, 2026

    @juan-campuzano
    Author

    @juan-campuzano Can you provide an example directory structure of this?

    @vashworth sure, here you go:

    NUXXXXX_Device_plugin_Lib/
    ├── analysis_options.yaml
    ├── azure-pipelines.yml
    ├── CHANGELOG.md
    ├── README.md
    ├── pubspec.yaml
    ├── version.txt
    ├── android/
    │   ├── build.gradle
    │   ├── gradle.properties
    │   ├── settings.gradle
    │   ├── gradle/
    │   │   └── wrapper/
    │   │       └── gradle-wrapper.properties
    │   └── src/
    │       └── main/
    │           ├── AndroidManifest.xml
    │           └── java/
    ├── example/
    │   ├── analysis_options.yaml
    │   ├── pubspec.yaml
    │   ├── README.md
    │   ├── android/
    │   ├── ios/
    │   ├── lib/
    │   │   └── main.dart
    │   └── test/
    │       └── widget_test.dart
    ├── ios/
    │   ├── device_plugin.podspec
    │   ├── Assets/
    │   └── device_plugin/
    │       ├── Package.swift
    │       └── sources/
    ├── lib/
    │   ├── device_plugin.dart
    │   └── src/
    │       ├── device_model.dart
    │       ├── device_plugin.dart
    │       └── device_helper.dart
    ├── pipelines/
    │   ├── build.yaml
    │   ├── config.yaml
    │   ├── publish.yaml
    │   └── variables.yaml
    ├── scripts/
    │   ├── check_all_test_ok.py
    │   ├── check_changelog.dart
    │   ├── check_linter_rules.sh
    │   └── azure_automation/
    └── test/
        ├── device_plugin_test.dart
        ├── device_helper_test.dart
        └── main_test.dart
    
  6. vashworth commented on Aug 21, 2026

    @vashworth
    Contributor

    @juan-campuzano Can you verify your issue is fixed on the latest main branch?

  7. juan-campuzano commented on Aug 21, 2026

    @juan-campuzano
    Author

    @vashworth sure, we'll give it a try and will let you know, thank you!

  8. juan-campuzano commented on Aug 24, 2026

    @juan-campuzano
    Author

    @vashworth we verified it and it is currently working, will this be released in a patch version of 3.47?

  9. github-actions commented on Sep 7, 2026

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  10. locked as resolved and limited conversation to collaborators on Sep 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work listhas reproducible stepsThe issue has been confirmed reproducible and is ready to work onplatform-iosiOS applications specificallyt: xcode"xcodebuild" on iOS and general Xcode project managementteam-iosOwned by iOS platform teamtoolAffects the "flutter" command-line tool. See also t: labels.triaged-iosTriaged by iOS platform team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions