Android Studio: resolve " Namespace 'androidx.compose.material3.adaptive' is used in multiple modules and/or libraries"?


I have a build that's failing, and I think it's due to the way that Android Studio imported dependencies into my project. However I can't find a way to remove the import or a way to manually edit the configuration, so I'm really stuck.

Running './gradlew lint' includes the following output which I think is the root cause:


> Task :app:processDebugMainManifest FAILED
[androidx.compose.material3.adaptive:adaptive-android:1.3.0] C:\Users\Brenden\.gradle\caches\9.3.1\transforms\2ac2ee3dfd35726224af015c992745cc\workspace\transformed\adaptive\AndroidManifest.xml Error:

        Namespace 'androidx.compose.material3.adaptive' is used in multiple modules and/or libraries: androidx.compose.material3.adaptive:adaptive-android:1.3.0, androidx.compose.material3:material3-adaptive-android:1.0.0-alpha06. 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

D:\Dev\AndroidProj\DiceyRolls\app\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.

So I can see that there's two imports of the same package, androidx.compose.material3.adaptive:adaptive-android for both 1.3.0 and 1.0.0 alpha, and I'm pretty sure that's wrong. I can't however find a way to remove one (or both) from Android Studio or where these are referenced in my project files for manual removal.

Any help updating removing the 'alpha' import or other ways of resolving this would be greatly appreciated.

0
Sep 9 at 10:39 PM
User Avatarmarkspace
#android#android-studio#gradle

Accepted Answer

enter the command

./gradlew app:dependencies --configuration debugRuntimeClasspath

This should show you a tree with all the hidden launches.
In it, you need to find something like.

*.material3.adaptive:... and something that contains 1.0.0

If it is loaded in `build.gradle` or `settings.gradle', then just delete. There will be something like this

implementation "androidx.compose.material3.adaptive:adaptive-android:1.0.0"

If this library is pulled up by something inside, then it is more difficult. Can try to isolate it.

implementation("androidx.compose.material3.adaptive:adaptive-android:1.0.0") {
    exclude(group = "androidx.compose.material3", module = "material3-adaptive-android")
}

here it is described in more detail

User Avataruser31774114
Sep 9 at 11:14 PM
1