github/gitignore · Android.gitignore
Android .gitignore Template Explained
Why Android.gitignore ignores Gradle caches, build output, local.properties, APK/AAB, .idea, signing keystores and google-services.json, and how to decide.
Android.gitignore is for app projects built with Android Studio and Gradle. It blocks Gradle build caches and output, SDK paths that only mean something on the developer's machine, and sensitive files such as app signing keys.
It differs from the JetBrains template in that it ignores the IDE folder .idea/ entirely. To share code style or run configurations with your team, you need to adjust this rule.
Rules explained
| Pattern | What it ignores and why |
|---|---|
.gradle/build/.kotlin/ | Gradle caches and buildsGradle task caches, per-module build output and Kotlin 2.0 plugin data. All are recreated. |
local.properties | Local settingsContains the Android SDK/NDK install path (sdk.dir), so the value differs per person. Android Studio creates it automatically. |
.externalNativeBuild/.cxx/ | Native buildsIntermediate folders created when building C/C++ code with CMake or ndk-build. |
*.apk*.aaboutput-metadata.json | App packagesBuilt APKs and App Bundles and their metadata. They are handled by store uploads or the deployment pipeline. |
*.iml.idea/misc.xmldeploymentTargetDropDown.xmlrender.experimental.xml | IDE filesAndroid Studio module files, the IDE settings folder, and files holding personal state such as the selected deployment target device. |
*.jks*.keystore | Signing keysKeystores used to sign the app. If leaked, someone else could publish an app with the same signature, so keep them out of the repository. |
google-services.json | Firebase and Google services configContains the Firebase project identifiers and API key. It is not a secret key, but public repositories often exclude it; if excluded, CI has to supply it separately for the build to work. |
captures/*.hprof*.log | Diagnostic filesProfiler captures, heap dumps and logs. They are large and one-off. |
Practical notes
- Commit
gradlew,gradlew.batandgradle/wrapper/. This template does not ignore*.jar, but if you use it with the Java template, put the Gradle template after it to keep the wrapper jar. - If you want to share code style (
.idea/codeStyles/), use the finer-grained rules of the JetBrains template instead of.idea/. - If your team commits
google-services.json, remove this line. Either way, never commit service account keys (JSON).
Original template
Android.gitignore
# Gradle files.gradle/build/.kotlin/# Local configuration file (sdk path, etc)local.properties# Log/OS Files*.log# Android Studio generated files and folderscaptures/.externalNativeBuild/.cxx/*.aab*.apkoutput-metadata.json# IntelliJ*.iml.idea/misc.xmldeploymentTargetDropDown.xmlrender.experimental.xml# Keystore files*.jks*.keystore# Google Services (e.g. APIs or Firebase)google-services.json# Android Profiling*.hprof
Templates from github/gitignore/Android.gitignore @356fd7b (2026-09-11) · CC0-1.0