Hello guys, I noticed a bug with Android Studio w...
# android-studio
s
Hello guys, I noticed a bug with Android Studio when working with a KMP library and using Gradle's dependency substitution. Let's assume I have the following project structure.
Copy code
lib
app
Both are Gradle projects.
lib
is a KMP library with a Gradle module named
library
and
app
is a regular Android app. In
settings.gradle.kts
of
app
I include
lib
and make use of dependency substitution.
Copy code
includeBuild("../lib") {
    dependencySubstitution {
        substitute(module("my.example.library:library")).using(project(":library"))
    }
}
This works from the terminal but unfortunately when opening
app
in Android Studio I get the following error in the Sync window and the project cannot be loaded/synced
Copy code
Expected android module not found! /Users/sven/Developer/Workspace/kmp-substitution/app::library
I can reproduce it with Android Studio Meerkat Feature Drop | 2024.3.2 (AGP
8.10.0
) as well as Android Studio Narwhal Feature Drop | 2025.1.2 Canary 2 (AGP
8.12.0-alpha02
). Gradle version is
8.14.1
. Kotlin
2.1.21
. An example project that reproduces this can be found here. Has anyone seen this error before and found a solution? If not, where would I best report this bug? I'm not sure if this bug is related to Android Studio, Gradle or maybe KMP?
g
s
Thank you, this seems to be related. I created an issue here.