Skip to content
This repository was archived by the owner on Feb 6, 2026. It is now read-only.

Minimal reproducible example for Android Studio and IntelliJ IDEA bug relating Gradle Composite Builds.

License

Notifications You must be signed in to change notification settings

DavideCannizzo/AndroidKmpBugMRE

Repository files navigation

AndroidKmpBugMRE

UPDATE: The issue was fixed by JetBrains, as tracked here. The repository is now archived and may be deleted in the future.

This project demonstrates how to reproduce an Android Studio and IntelliJ IDEA bug that shows in Gradle Composite builds. Specifically, the issue affects Android-targeting Gradle projects that are part of included builds based in a subfolder of the workspace root. All references to Android SDK APIs are shown as unresolved by IDE, although everything builds fine. Identical Android-targeting Gradle projects are analyzed correctly when they are instead part of the build located at the workspace root.

The issue only affects projects using the new com.android.kotlin.multiplatform.library plugin, while com.android.library still works fine despite its integration with org.jetbrains.kotlin.multiplatform being deprecated.

Android Gradle Plugin

The bug was reproduced with AGP 8.13.2 and 9.0.0-rc03 as well (tested in Android Studio), but the project is currently using 8.12.3 to be compatible with stable IntelliJ IDEA. Both IDEs seem to behave in the exact same way as far as the issue is concerned.

Project Structure

The project is structured as a Gradle Composite Build, which includes the following builds:

  • / — which includes the :app subproject.
  • /libs — where all non-app-specific libraries reside.

The settings.gradle.kts script of each included build configures the default group and version for all projects inside it.

The Actual App

The :app subproject is further divided into:

  • :app:app — which is a Kotlin Multiplatform project and contains the actual sources.
  • :app:app-android — which is an Android application project and just contains the app manifest, but it consumes the :app:app library.

This division is very artificial, but used to avoid mixing up the Kotlin Multiplatform Gradle plugin and the Android Gradle plugin, which are no longer considered compatible.

The Affected Library Project

The /libs build is included from the build at the workspace root and includes :lib-foo and :lib-bar.

  • :lib-foo, which uses com.android.kotlin.multiplatform.library and presents the issue where all Android SDK API references are shown as unresolved. The bug can be observed in Foo.kt.
  • :lib-bar, which uses com.android.library, and despite the warning it works fine and doesn't present the issue. Check out Bar.kt.

An additional, smaller issue is that both :libs:lib-foo and :app:app, i.e. all projects using com.android.kotlin.multiplatform.library, report the following warning during Gradle sync:

w: Unused Kotlin Source Sets
The Kotlin source set commonTest was configured but not added to any Kotlin compilation.
Solution: You can add a source set to a target's compilation by connecting it with the compilation's default source set using 'dependsOn'.
See https://kotl.in/connecting-source-sets