Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What to commit into VCS from a Gradle project in Android Studio

I am using Android Studio 0.4.6 and Gradle 1.10. I want to commit into git the necessary files and folders, so that anyone cloning the repository can start working with the project and will not have any issues of missing files/settings because of not commited file. Could someone point what is needed to be into VCS and what is optional.

From question: "gradle directory in an Android Studio project" I see that the gradle/ folder is good to have it, but what about .idea/, .gradle/, gradlew.bat etc... I see inside local.properties that it should not be commited, but what about everything else?

Here is my .gitignore that works perfect for me now:

/app/build .idea/workspace.xml .idea/tasks.xml .gradle local.properties 
like image 536
dragi Avatar asked Mar 06 '14 08:03

dragi


People also ask

Should I commit Gradle files?

If you don't upgrade gradle often (most of us don't), it's better to commit it to VCS. And the main reason for me is to increase the build speed on the CI server. Nowadays, most of the projects are getting built and installed by CI servers, different server instance every time.

What does Android Studio use Gradle scripts for?

Android Studio uses Gradle, an advanced build toolkit, to automate and manage the build process, while allowing you to define flexible custom build configurations. Each build configuration can define its own set of code and resources, while reusing the parts common to all versions of your app.

What does Sync project with Gradle files do?

The button does what it says: it updates the Android Studio project model to match the contents of the Gradle build file.


1 Answers

You can take a look at What should be in my .gitignore for an Android Studio project?

If you use the .gitignore file from that questions you shouldn't have any problems.

I think that if you create a new project inside a git directory Android Studio will automatically create the necessary .gitignore files for your project.

EDIT: Actually it seems that my Android Studio always generates .gitignore files when I create a project.

like image 192
Jesper Riemer Andersen Avatar answered Sep 20 '22 12:09

Jesper Riemer Andersen