List of directories and files to be excluded when importing into a version control (relative to the root of the project):

.gradle (directory)
build (directory)
local.properties (file)
app/build (directory)
.idea/libraries (directory)
.idea/gradle.xml (file)
.idea/workspace.xml (file)

There are a couple of different ways to have the above directories and files not present in the version control:

1. Exclude them from the initial import
2. Delete them after the import


svn delete -m "Delete .gradle dir" http://server/path/to/repository/.gradle
svn delete -m "Delete build dir" http://server/path/to/repository/build
svn delete -m "Delete app/build dir" http://server/path/to/repository/app/build
svn delete -m "Delete local.properties" http://server/path/to/repository/local.properties
svn delete -m "Delete .idea/libraries dir" http://server/path/to/repository/.idea/libraries
svn delete -m "Delete gradle.xml" http://server/path/to/repository/.idea/gradle.xml
svn delete -m "Delete workspace.xml" http://server/path/to/repository/.idea/workspace.xml

Now that we have gone through that, the version control does not have these directories and files, but locally, the project on your computer has these (if not they will be automatically generated when you first open the project in Android Studio or you build the project).

That means that we need to delete them from svn locally and tell svn locally to ignore them:


svn ps svn:ignore '.gradle local.properties build' .
svn ps svn:ignore build app
svn ps svn:ignore 'libraries gradle.xml workspace.xml' .idea
Android Studio- What files and directories to exclude when importing into Subversion (or Git)
Tagged on:                 

3 thoughts on “Android Studio- What files and directories to exclude when importing into Subversion (or Git)

  • October 24, 2016 at 4:38 am
    Permalink

    Awesome blog , thanks for the help .

  • March 19, 2017 at 2:19 pm
    Permalink

    I frequently visit this post whenever I initiate a new Android project.

  • July 27, 2017 at 2:27 pm
    Permalink

    How do you do “1. Exclude them from the initial import”? Thank you

Leave a Reply

Your email address will not be published. Required fields are marked *

*