An IntelliJ Platform plugin that lets Android developers enable or disable Gradle modules from the IDE. When selected modules are Android dynamic features, the plugin also keeps the base application's dynamicFeatures declaration aligned and starts a Gradle sync.
This repository accompanies How I Reduced Android Compilation Time by 70%, but the implementation has been hardened for use outside the original sample project.
settings.gradle.ktsandsettings.gradle.- Kotlin and Groovy
include(...)syntax. - Multiple and multiline module declarations.
- Nested paths such as
:feature:payments. - Kotlin and Groovy Android
dynamicFeaturesdeclarations. - Required modules, hidden modules, custom application directories, and configurable dynamic-feature prefixes.
- A fail-closed change plan: every target is parsed and validated before any IDE document is changed.
- One grouped IDE write command followed by Gradle sync only when files changed.
- Open a Gradle project in Android Studio or IntelliJ IDEA with the Gradle plugin installed.
- Select Tools → Manage Android Modules.
- Choose the modules to keep enabled, or apply one of the presets.
- Select Apply and Sync.
The plugin normalizes module paths to Gradle's :module:path form. Required modules cannot be deselected. Hidden modules preserve their current state and are not shown in the dialog.
The Gradle files are version-controlled project files. Review or revert their changes with the IDE or Git before committing them.
Add an optional .android-dynamic-modules.properties file to the project root:
applicationModule=:app
# Optional when the application module has a custom projectDir.
# applicationModuleDirectory=applications/mobile
requiredModules=:app,:core
hiddenModules=:build-logic
dynamicFeaturePrefixes=df_,dynamic_All module lists are comma-separated. Without this file the defaults are:
- application and required module:
:app; - no hidden modules;
- dynamic-feature prefix:
df_.
A module already listed in the application's dynamicFeatures declaration is recognized as dynamic even when it does not match a configured prefix.
The plugin never writes an empty fallback after a read error. Its workflow is:
- resolve exactly one settings file and, when required, exactly one application build file;
- parse all literal module declarations;
- prepare the complete changes in memory;
- verify that open IDE documents still match the loaded snapshot;
- update the documents as one IDE command;
- save and start Gradle sync.
If a file changed while the dialog was open, a dynamic-feature declaration is missing, both Groovy and Kotlin variants exist, or a statement is structurally invalid, the operation stops without applying the plan.
include(":app", ":feature:login")
// include(":optional")
android {
dynamicFeatures += setOf(":df_payments", ":df_profile")
}include ':app', ':feature:login'
android {
dynamicFeatures = [':df_payments', ':df_profile']
}Only literal quoted module paths are managed. Computed includes, version-catalog logic, custom functions, and arbitrary Gradle expressions are intentionally left untouched.
Requirements:
- JDK 21;
- Gradle Wrapper included in this repository.
Run the quality gates:
./gradlew check buildPlugin verifyPluginUseful tasks:
./gradlew runIde
./gradlew test
./gradlew buildPluginThe app, optional, and hiddenmodule subprojects are lightweight sandbox fixtures. Their behavior is described by the repository's .android-dynamic-modules.properties file.
The plugin is built with IntelliJ Platform Gradle Plugin 2.x, targets IntelliJ Platform build 242 or newer, and declares a required dependency on the bundled Gradle plugin. Compatibility is checked by CI with the IntelliJ Plugin Verifier.
See CONTRIBUTING.md. Please include tests for parser, renderer, or file-planning changes.