HomeAbout MeContact Me
Android Studio gitignore to avoid useless files
Android
Android Studio gitignore to avoid useless files
Emanuele Papa
Emanuele Papa
November 20, 2015
1 min

Create a perfect Android Studio .gitignore file is sometimes tedious, so I have gathered some information on the Internet, mainly on StackOverflow, I made some experiments with my sample project over and over and finally I obtained a perfect Android Studio .gitignore file.

Usually, I create my project inside a parent folder which I initialize as my Git repository.

So, for example, this is a sample structure (folders are bolded):

AndroidShowcaseRepository

  • .git
  • AndroidShowCase
    • .gradle
    • .idea
    • app
    • build
    • gradle
    • .gitignore
    • AndroidShowcase.iml
    • build.gradle
    • gradlew
    • gradlew.bat
    • local.properties
    • settings.gradle
  • .gitignore
  • LICENSE
  • README.md

I use the following as content for the .gitignore file in the AndroidShowcaseRepository folder

# Built application files
*.apk
*.ap_
# Files for the Dalvik VM
*.dex
# Java class files
*.class
# Generated files
bin/
gen/
# Gradle files
.gradle/
build/
/*/build/
# Local configuration file (sdk path, etc)
local.properties
# Proguard folder generated by Eclipse
proguard/
# Log Files
*.log

and the following as content for the .gitignore file in the AndroidShowcase folder

.gradle
/local.properties
.DS_Store
/build
/captures
.idea
gradlew
gradlew.bat
gradle

Using these two .gitignore files (and the default ones created by Android Studio inside the app folder and into other folders you could have) you will likely save only the necessary source code to your repository and not files which could be generated by Android Studio itself.

Check w3ma showcase repository for the complete source code and for more explanation!


Tags

Share


Previous Article
Making TextView with clickable link in Android
Emanuele Papa

Emanuele Papa

Android Developer

Related Posts

Kotlin Multiplatform and Swift - Overcoming Interoperability Challenges for Multiplatform Development
Kotlin Multiplatform and Swift - Overcoming Interoperability Challenges for Multiplatform Development
July 16, 2023
4 min

Quick Links

HomeAbout MeContact MeRSS Feed

Social Media