androidmavengradlekotlin-multiplatform-mobilekmm

How to successfully publish a KMM library on localMaven() for android project to consume it?


I'm trying to integrate KMM library I made with my Android project. Till now I've successfully published the KMM library locally by following the steps here

But unfortunately when trying to add it as a dependency in my Android project the project doesn't build:

Execution failed for task ':app:mergeDebugNativeLibs'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
> Could not find com.example.kmm:core-android:1.0.0-snapshot.1.
 Searched in the following locations:
   - https://dl.google.com/dl/android/maven2/com/example/kmm/core-android/1.0.0-snapshot.1/core-android-1.0.0-snapshot.1.pom
   - https://repo.maven.apache.org/maven2/com/example/kmm/core-android/1.0.0-snapshot.1/core-android-1.0.0-snapshot.1.pom
 Required by:
     project :app

I've already added mavenLocal() to my repositories

repositories {
    google()
    mavenCentral()
    mavenLocal()
}

But still getting nothing, any help ?

Note: when trying to consume the library in another KMM project or Module it successfully builds.


Solution

  • Seems like a trivial mistake I was trying to add mavenLocal() repository to the project build.gradle file when I was supposed to add it to the settings.gradle file which obviously overrides the repositories declared in the build.gradle