A .gitignore builder for Android Studio projects in Java or Kotlin. Tick the sections your app uses — Gradle build output, local.properties, packaged APK/AAB artifacts, IDE settings and signing keystores — and the tool assembles a clean, labelled .gitignore.
How it works
Each toggle adds a curated block of patterns under a # Header comment. The Gradle / build block ignores .gradle/, build/ and per-module */build/ directories that Gradle regenerates. The Local config block ignores local.properties, which points to each developer’s SDK path. The artifacts block ignores generated *.apk, *.aab, *.dex and mapping.txt, and the keystores block keeps signing files like *.jks out of version control.
What each section covers
Gradle and build output
The build/ directory and .gradle/ cache are regenerated by Gradle on every build. Committing them bloats the repository, causes frequent merge conflicts (since file timestamps and intermediate bytecode change on every compile), and offers no benefit — any contributor or CI runner can regenerate them with ./gradlew assembleDebug. The per-module */build/ pattern catches sub-project build directories in multi-module apps.
Local properties and SDK path
local.properties is created by Android Studio to record the absolute path to your Android SDK and NDK installation on each machine. Because every developer’s machine is different, this file is inherently local. Committing it breaks every other developer’s setup because their SDK lives at a different path. Android Studio generates it fresh if it is missing, so ignoring it is always correct.
APK, AAB, and Proguard mapping
Build outputs like *.apk, *.aab, and *.dex should never live in version control. They are large binary files that change on every build, git cannot diff or merge them meaningfully, and they can be reproduced exactly from the source and signing key. The mapping.txt file produced by ProGuard/R8 is also ignored here — store it alongside the release build in your distribution pipeline (Google Play Console keeps it automatically for uploaded AABs).
Signing keystores
A release keystore (*.jks, *.keystore) combined with its passwords is the only credential that lets someone publish updates to your Play Store app under your developer account. If it leaks through version control history it cannot be revoked — the signed APK it produces will be trusted by Android devices regardless. Keep it in a secrets manager (such as GitHub Secrets, AWS Secrets Manager, or an encrypted vault) and inject it into CI only for release builds.
Android Studio IDE settings
.idea/ contains the IntelliJ project settings directory. Some files inside it are useful to share (codeStyles/, copyright/, dictionaries/) while others are developer-specific (run configurations, editor UI state). The most practical approach for most teams is to ignore the entire .idea/ directory, or to ignore only the user-specific subdirectories. This builder ignores the whole directory.
What should NOT be ignored
The Gradle wrapper files — gradlew, gradlew.bat, and gradle/wrapper/gradle-wrapper.properties — must be committed. They pin the exact Gradle version your project requires and allow any developer or CI runner to build without installing Gradle manually. Ignoring the wrapper defeats most of the consistency benefit of using Gradle.
Tips
Place the file at the root of your repository so the rules cover every module. Always commit the Gradle wrapper (gradlew, gradle/wrapper/) so contributors and CI use the same Gradle version. Store signing keystores and passwords in a CI secrets vault, never the repo. If a build file is already tracked, run git rm --cached <file> and commit so the ignore rule takes effect.