Home » Android » Eclipse Android and gitignore

Eclipse Android and gitignore

Posted by: admin March 10, 2020 Leave a comment


What files/folders can I safely ignore for inclusion with git?

I copied a good project, removed its gen and bin folders and tried to run the app. The Android Launch window says, “Your project contains error(s), please fix them before running your application. There is a red X on the icon to the left of the project in the Package Explorer. While the gen folder does not exist in Windows Explorer, it does in Package Explorer.

How to&Answers:

There are file types to ignore

# built application files

# files for the dex VM

# Java class files

# generated files

# Local configuration file (sdk path, etc)

# Eclipse project files

# Proguard folder generated by Eclipse

# Intellij project files

From Gitignore on github


What I usually add to .gitignore is:


bin and gen are constantly changed while coding, so there’s no need to include them into the Git repository. Also, sometimes I add .classpath and .project which are Eclipse specific files, because maybe I want to create a new Android project based on these same sources, but in another OS or IDE.

With regards to the error, I would clean the project and/or try to run the Fix Project Properties utility (right-click on the Project -> Android Tools -> Fix Project Properties).


Best solution today is probably to generate the exact .gitignore file you need. Just go to http://www.gitignore.io

The project is also on Github: https://github.com/joeblau/gitignore.io


It’s safe to ignore bin and gen, without problems.
When I have problems with a project setup, I do this:
First – have you looked at the ‘Problems’ tab in the view underneath the editor view – it generally gives more detailed information about project errors. If there’s nothing conclusive there, I do the things below:

  1. Generally, when I’m having issues with Eclipse giving me phantom errors in the project, cleaning the project will fix it. It’s in the menu, under Project>Clean.
  2. If that doesn’t work, I’ll usually try right clicking the project, going to Android Tools> Fix project properties.
  3. My last resort it to restart eclipse and delete the gen folder.


the best way is use this site to generate: http://www.gitignore.io/


The simple answer to this question is *.* , basically it’s completely safe to ignore anything you don’t want to add to version control. That being said it really depends on what you’re looking to accomplish by using Git. If you want to be able to checkout/import your project elsewhere from the same repository then you’ll want to ignore at most /bin/. and /gen/., I wouldn’t ignore the folders themselves (i.e. /bin, /gen) just for the sake of maintaining the proper directory structure for your project.

That answers the initial question, but is unrelated to the problem you are having. As far as solving the problem you are experiencing is concerned you would have to post more info, specifically what’s listed in the Problems tab. If you can’t see the Problems tab anywhere then click on the Window menu, then show view, then choose problems if it’s there or click on other and look under General to find it.