svenjacobs
05/27/2025, 10:22 AMlib
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.
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
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?gmz
05/29/2025, 12:48 PMsvenjacobs
05/29/2025, 12:54 PM