Android IDE Support
This page outlines the current IDE support for Android projects built with Mill. Mill integrates with IntelliJ IDEA and Android Studio by either:
-
using the BSP (Build Server Protocol) plugin
-
generating the necessary project (
idea/) files for direct import.
Both options work, but they have different trade-offs depending on which IDE features you rely on.
Importing with BSP
BSP import is the recommended default for most projects:
-
fast to set up
-
keeps the IDE model close to Mill’s build definition
-
works well for basic Java/Kotlin editing, navigation, and static import features.
|
Some advanced Android/Kotlin IDE features are not always fully supported via BSP. In particular, if you rely on Jetpack Compose IDE highlighting/support, switch to the generated IntelliJ project files import described below. |
To use BSP, import the project in IntelliJ IDEA / Android Studio via BSP
If you do not see the option to import via BSP, ensure you have the Build Server Protocol plugin installed and that you have run mill --bsp-install in your project directory.
Generating IntelliJ IDEA project files
If you want Jetpack Compose support or prefer to work with generated project files, you can generate IntelliJ project files and import those directly.
To generate and import IntelliJ project files:
-
Do not yet import the project into the IDE.
-
Delete
.bspand.ideadirectories if they exist. -
Run
mill mill.idea/to generate the IntelliJ project files. -
Open the project in IntelliJ (File → Open) and select the project directory.
As mentioned in the IDE setup page, if you make any changes to your build.mill definitions, you must regenerate the IntelliJ project files by running mill mill.idea/ again.
Jetpack Compose IDE Support
Jetpack Compose IDE support is currently experimental and only available when using the generated IntelliJ project files import method. To enable Jetpack Compose IDE support:
-
Have the Kotlin plugin installed in your IDE.
-
Mix the
KotlinIdeaModuletrait into yourAndroidKotlinModuledefinitions inbuild.mill, so the appropriate Facets and configurations are generated for your Kotlin sources.
Static Import Features and R Class Support
Mill provides syntax highlighting and code completion for Android-specific classes such as R in supported IDEs.
This enables a smooth editing experience similar to standard Android development.
|
To ensure correct resolution of generated paths and resources, you must run a compilation from the command line after making changes to resource files or |
File Type Associations and Project Layout
The IDE properly recognizes file types and project layout when imported through the above methods:
-
Source files, resource folders, and generated outputs are color-coded as expected.
-
Test directories are identified and appear in green.
-
Output folders (e.g.,
out/) and build targets appear in orange, indicating generated content.
Logcat Integration
While Logcat is primarily an Android Studio feature, it can be accessed in IntelliJ IDEA with the Android plugins installed.
Troubleshooting
If IDE features seem incomplete or broken:
-
Run
mill __.compileto regenerate class files and trigger updates. -
If you imported through BSP, resync the BSP project in your IDE.
-
If using IntelliJ project files but the project structure still seems broken, close the IDE and try repeating the instruction steps above to regenerate the project files and re-import.
-
Delete the
outdirectory in case of persistent issues, then recompile the project.