The plugin's Android module declares namespace 'com.segment.analytics' — the same namespace as Segment's native Android SDK (com.segment.analytics.kotlin:android, whose AAR manifest declares package="com.segment.analytics"). AGP 9 treats duplicate namespaces as a hard manifest-merger error, so any app that has both in its dependency graph no longer builds. This happens in practice with SDKs that embed analytics-kotlin, e.g. the Customer.io SDK (customer_io → io.customer.android:datapipelines → com.segment.analytics.kotlin:android).
Steps to reproduce
- Flutter app with
segment_analytics: 1.1.12 and AGP 9.x (tested with 9.1.0).
- Add the native SDK to
android/app/build.gradle (or any dependency that pulls it in, e.g. customer_io):
dependencies {
implementation "com.segment.analytics.kotlin:android:1.24.1"
}
flutter build apk --debug
Result
[:segment_analytics] .../merged_manifest/debug/processDebugManifest/AndroidManifest.xml Error:
Namespace 'com.segment.analytics' is used in multiple modules and/or libraries: :segment_analytics, com.segment.analytics.kotlin:android:1.24.1. Please ensure that all modules and libraries have a unique namespace.
Execution failed for task ':app:processDebugMainManifest'.
> Manifest merger failed with multiple errors, see logs
Fix
Rename the plugin's namespace to something unique, e.g. com.segment.analytics.flutter, and drop the deprecated package= attribute from AndroidManifest.xml. The namespace only affects the generated R/BuildConfig package, not the Dart API or Kotlin source packages. We've been running this patch in production: cheddar-me@dda9906
The plugin's Android module declares
namespace 'com.segment.analytics'— the same namespace as Segment's native Android SDK (com.segment.analytics.kotlin:android, whose AAR manifest declarespackage="com.segment.analytics"). AGP 9 treats duplicate namespaces as a hard manifest-merger error, so any app that has both in its dependency graph no longer builds. This happens in practice with SDKs that embed analytics-kotlin, e.g. the Customer.io SDK (customer_io→io.customer.android:datapipelines→com.segment.analytics.kotlin:android).Steps to reproduce
segment_analytics: 1.1.12and AGP 9.x (tested with 9.1.0).android/app/build.gradle(or any dependency that pulls it in, e.g.customer_io):flutter build apk --debugResult
Fix
Rename the plugin's namespace to something unique, e.g.
com.segment.analytics.flutter, and drop the deprecatedpackage=attribute fromAndroidManifest.xml. The namespace only affects the generatedR/BuildConfigpackage, not the Dart API or Kotlin source packages. We've been running this patch in production: cheddar-me@dda9906