Skip to content

fix(android): use a unique namespace to avoid collision with analytics-kotlin under AGP 9 - #215

Merged
MichaelGHSeg merged 1 commit into
segmentio:mainfrom
cheddar-me:fix/unique-android-namespace
Oct 8, 2026
Merged

MichaelGHSeg merged 1 commit into
segmentio:mainfrom
cheddar-me:fix/unique-android-namespace

Conversation

@MarcinusX

Copy link
Copy Markdown

Fixes #214.

The core plugin declared namespace 'com.segment.analytics', which collides with com.segment.analytics.kotlin:android when both end up in an app's dependency graph (common via SDKs that embed analytics-kotlin, e.g. Customer.io). AGP 9 escalates duplicate namespaces to a hard manifest-merger error — full repro and error output in #214.

Changes:

  • packages/core/android/build.gradle: namespace 'com.segment.analytics' → 'com.segment.analytics.flutter'
  • packages/core/android/src/main/AndroidManifest.xml: drop the deprecated package= attribute (superseded by the gradle namespace)

The namespace only determines the generated R/BuildConfig package; Dart API and Kotlin source packages are unchanged. Note for consumers pinning ProGuard/R8 rules to the old BuildConfig package: this is technically observable, so it may warrant a minor version bump.

We've shipped this patch in production since June via a fork.

…s-kotlin

The core plugin declared namespace 'com.segment.analytics', which is also
the manifest package of com.segment.analytics.kotlin:android. When both end
up in an app's dependency graph (e.g. via an SDK that embeds analytics-kotlin),
AGP 9 fails the build with a duplicate-namespace manifest-merger error.
Rename to com.segment.analytics.flutter and drop the deprecated manifest
package= attribute. Dart API and Kotlin source packages are unchanged.

Fixes segmentio#214

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

@MichaelGHSeg MichaelGHSeg left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Nothing in core references R or BuildConfig, so the rename is safe. Tested together with the other release changes in #219: CI green there, Flutter 3.29.2 tests, and an SPM build plus simulator run on Flutter 3.47.6.

@MichaelGHSeg
MichaelGHSeg merged commit efc6cd4 into segmentio:main Oct 8, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Android build fails under AGP 9 when analytics-kotlin is also in the dependency graph: duplicate namespace 'com.segment.analytics'

2 participants