RevenueCat/purchases-kmp

Namespace collision between :core and :models when uniquePackageNames is enabled

Closed this issue · 6 comments

Describe the bug
With the release of 1.0.0 the :models module was added, however, the namespace in it is the same as in :core module. With the android.uniquePackageNames=true property this leads to an exception during the compilation of the Android app.

namespace = "com.revenuecat.purchases.kmp"

> Task :app-android:processDevDebugMainManifest FAILED
[com.revenuecat.purchases:purchases-kmp-core-android:1.0.0+13.2.0] /Users/alexey/.gradle/caches/8.8/transforms/61696659ac84c82bf00d9657d836fdb4/transformed/core-release/AndroidManifest.xml Error:
	Namespace 'com.revenuecat.purchases.kmp' is used in multiple modules and/or libraries: com.revenuecat.purchases:purchases-kmp-core-android:1.0.0+13.2.0, com.revenuecat.purchases:purchases-kmp-models-android:1.0.0+13.2.0. Please ensure that all modules and libraries have a unique namespace. For more information, See https://developer.android.com/studio/build/configure-app-module#set-namespace
/Users/alex/StudioProjects/own/xxx/app-android/src/main/AndroidManifest.xml Error:
	Validation failed, exiting

See https://developer.android.com/r/studio-ui/build/manifest-merger for more information about the manifest merger.

The solution is to change the namespace accordingly to have a module name at the end like in other modules:

namespace = "com.revenuecat.purchases.kmp.mappings"

Our temporary fix is to disable android.uniquePackageNames property in out project.

  1. Environment
    1. Platform: Android
    2. SDK version: 1.0.0
    3. OS version: macOS
    4. IDE (e.g. Android Studio, Xcode, Fleet):
    5. IDE version:
    6. Device and/or emulator/simulator:
      • Device
      • Emulator/simulator
    7. Environment:
      • Closed testing / Sandbox
      • TestFlight
      • Production
    8. How widespread is the issue. Percentage of devices affected.
  2. Debug logs that reproduce the issue
    Not needed
  3. Steps to reproduce, with a description of expected vs. actual behavior
    You need to enable android.uniquePackageNames inside gradle.properties and build the android app.

TIL about android.uniquePackageNames, thanks for reporting this! We'll have a look at what the best course of action would be.

All the above PRs have been merged. This should be in the next release.

@alaegin Latest release just went out. I'd be curious to know if it fixes the issue for you, whenever you have some time!

@JayShortway
Fixed the issue for me. I was having issues for the past few days on a new build. This was the last piece of the puzzle.

Hello, @JayShortway!

Problem solved, thank you!

@alaegin @adrianegraphene Great to hear, thanks both for confirming!