Skip to content

flutter build swift-package: generated FlutterPluginRegistrant fails with "conflicting name: 'Sentry'" when using sentry_flutter #189443

Description

@xiaoxiaowuelisa

Steps to reproduce

  1. flutter create --template=module my_module
  2. cd my_module
  3. Add sentry_flutter: ^9.24.0 to my_module/pubspec.yaml under dependencies
  4. flutter pub get
  5. flutter build swift-package --platform ios
  6. cd build/ios/SwiftPackages/FlutterNativeIntegration/Debug
  7. swift build

Expected results

flutter build swift-package --platform ios generates a FlutterPluginRegistrant
Swift package whose dependency graph resolves and builds successfully, so it can
be added to a host Xcode project (or built standalone with swift build) without
errors, even when the Flutter module depends on sentry_flutter.

Actual results

swift build (and Xcode package resolution) fails with:

error: multiple packages ('debug', 'sentry-cocoa') declare targets with a
conflicting name: 'Sentry'; target names need to be unique across the
package graph

This happens because the generated FlutterPluginRegistrant/Package.swift
declares a local binaryTarget built from CocoaPods:

.binaryTarget(
    name: "Sentry",
    path: "Frameworks/CocoaPods/Sentry.xcframework"
)

while also depending on sentry_flutter's own copied Package.swift
(Packages/sentry_flutter/Package.swift), which separately declares a remote
SPM dependency that vends its own target also named "Sentry":

.package(url: "https://github.com/getsentry/sentry-cocoa", exact: "8.58.3")

Both "Sentry" targets end up in the same package graph simultaneously, causing
the name collision.

Code sample

Code sample

pubspec.yaml for a minimal Flutter module used in add-to-app:

name: my_module
description: A new Flutter module.
version: 0.1.0
environment:
  sdk: '>=3.5.0 <4.0.0'
  flutter: '>=3.24.0'

dependencies:
  flutter:
    sdk: flutter
  sentry_flutter: ^9.24.0

Generated files relevant to the conflict:

build/ios/SwiftPackages/FlutterNativeIntegration/Debug/Package.swift:

let package = Package(
    name: "FlutterPluginRegistrant",
    ...
    dependencies: [
        .package(name: "sentry_flutter", path: "Packages/sentry_flutter"),
        ...
    ],
    targets: [
        .target(
            name: "FlutterPluginRegistrant",
            dependencies: [
                .product(name: "sentry-flutter", package: "sentry_flutter"),
                ...
                .target(name: "Sentry"),
            ]
        ),
        .binaryTarget(
            name: "Sentry",
            path: "Frameworks/CocoaPods/Sentry.xcframework"
        ),
    ]
)

build/ios/SwiftPackages/FlutterNativeIntegration/Debug/Packages/sentry_flutter/Package.swift:

let package = Package(
    name: "sentry_flutter",
    ...
    dependencies: [
      .package(url: "https://github.com/getsentry/sentry-cocoa", exact: "8.58.3"),
      .package(path: "../FlutterFramework"),
    ],
    targets: [
        .target(
            name: "sentry_flutter",
            dependencies: [
                "sentry_flutter_objc",
                .product(name: "Sentry", package: "sentry-cocoa"),
                ...
            ]
        ),
    ]
)

Screenshots or Video

Screenshots / Video demonstration

[Upload media here]

Logs

Logs
[Paste your logs here]

Flutter Doctor output

Doctor output
[✓] Flutter (Channel stable, 3.44.6, on macOS 26.5.2 25F84 darwin-arm64, locale en-FI) [6.5s]
    • Flutter version 3.44.6 on channel stable at /Users/xxx/fvm/versions/3.44.6
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision ee80f08bbf (6 days ago), 2026-07-08 15:02:06 -0700
    • Engine revision 83675ed276
    • Dart version 3.12.2
    • DevTools version 2.57.0
    • Feature flags: enable-web, enable-linux-desktop, enable-macos-desktop,
      enable-windows-desktop, enable-android, enable-ios, cli-animations,
      enable-native-assets, enable-swift-package-manager,
      omit-legacy-version-file, enable-lldb-debugging, enable-uiscene-migration

[✓] Xcode - develop for iOS and macOS (Xcode 26.6) [10.0s]
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 17F113
    • CocoaPods version 1.16.2

[✓] Connected device (1 available)
    • iPhone 17 Pro Max (mobile) • 99DF5211-7B92-4595-9231-AF052F6F4BE8 • ios
      • com.apple.CoreSimulator.SimRuntime.iOS-26-5 (simulator)

[✓] Network resources
    • All expected network resources are available.

• No issues found!

Activity

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

    @mbcorona
    Member

    Hi @xiaoxiaowuelisa, thanks for the rteport.

    Reproduced on macOS with Flutter 3.44.6 following the steps — swift build fails with:

    multiple packages ('debug', 'sentry-cocoa') declare targets with a conflicting name: 'Sentry'

    Routing to the tool team for further investigation.

  3. added
    team-iosOwned by iOS platform team
    fyi-toolFor the attention of Flutter Tool team
    and removed
    team-toolOwned by Flutter Tool team
    on Aug 4, 2026
  4. self-assigned this
    on Aug 6, 2026
  5. added
    P2Important issues not at the top of the work list
    triaged-iosTriaged by iOS platform team
    on Aug 6, 2026
  6. github-actions commented on Sep 4, 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.

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

Metadata

Metadata

Assignees

Labels

P2Important issues not at the top of the work lista: existing-appsIntegration with existing apps via the add-to-app flowfyi-toolFor the attention of Flutter Tool teamhas 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