Repository navigation
Description
Steps to reproduce
- flutter create --template=module my_module
- cd my_module
- Add
sentry_flutter: ^9.24.0to my_module/pubspec.yaml under dependencies - flutter pub get
- flutter build swift-package --platform ios
- cd build/ios/SwiftPackages/FlutterNativeIntegration/Debug
- 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.0Generated 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
mbcorona commentedon Jul 14, 2026
Hi @xiaoxiaowuelisa, thanks for the rteport.
Reproduced on macOS with Flutter 3.44.6 following the steps —
swift buildfails with:multiple packages ('debug', 'sentry-cocoa') declare targets with a conflicting name: 'Sentry'Routing to the tool team for further investigation.
[iOS][add2app] Skip building SwiftPM plugins when generating CocoaPod…
github-actions commentedon Sep 4, 2026
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 -vand a minimal reproduction of the issue.