Before proceeding, ensure you have the following tools installed:
- Android Studio
- TortoiseGit and msysGit
Identifying files to exclude from version control in Android projects:
Directories to ignore:
.gradle— Gradle temporary directory.idea— IDE-specific temporary filesbuild— Gradle build output directory
Files to exclude:
*.iml— Module definition fileslocal.properties— Local SDK paths and settings
Files that should not be excluded:
.classpath— Required by ADT/Eclipse, not used by Android Studio.project— Required by ADT/Eclipse, not used by Android Studio
Recommended exclusions in Android Studio:
.ideafolder.gradlefolder- All
buildfolders - All
.imlfiles local.propertiesfile
Proceeding with setup:
- Create an Android Studio project.
- Switch to Project view to see all directories.
- Open or create the
.gitignorefile in the root directory.
Replace its contents with one of the following configurations:
# Built application files
*.apk
*.ap_
*.iml
/.idea
# Files for the Dalvik VM
*.dex
# Java class files
*.class
# Generated files
bin
gen
.metadata
# Gradle files
.gradle/
buiild/
# Local configuration file (sdk path, etc)
local.properties
# Proguard folder generated by Eclipse
proguard/
# Log Files
*.log
Aletrnatively, use this more comprehensive version:
# Built application files
*.apk
*.ap_
# Files for the ART/Dalvik VM
*.dex
# Java class files
*.class
# Generated files
bin/
gen/
out/
# Gradle files
.gradle/
build/
# Local configuration file (sdk path, etc)
local.properties
# Proguard folder generated by Eclipse
proguard/
# Log Files
*.log
# Android Studio Navigation editor temp files
.navigation/
# Android Studio captures folder
captures/
# Intellij
*.iml
.idea/workspace.xml
# Keystore files
*.jks
This aligns with GitHub's official .gitignore template for Android projects.
Additional customizations can be added under the # Intellij section:
*.iws
.idea/
Explanation of patterns:
#— Comment marker; ignored by Git*.iml— Exclude all module definition files.gradle/— Ignore Gradle cache directorylocal.properties— Exclude local configuration file
Once configured, locate your project directory and confirm that .gitignore applies recursively to all subdirectories. Adding this file to the repository ensures that all team members share the same exclusion rules.
Using TortoiseGit to commit changes:
- Right-click the project folder.
- Select "TortoiseGit" → "Commit".
- Add files to staging area if needed.
- Enter a commit message.
- Click "OK" to commit.
- Push changes to remote repository.
Verify the committed files in your repository. If .idea folder still appears in the listing, update the .gitignore file accordingly by adding it to the exclusion list.