02162: Course on Software Engineering 2 (e15)
Using Subversive from Android Studio
Using subversive from Android Studio is different from using it from Eclipse.
In particular, Android Studio does not automatically ignore binary files,
local files and all the structures that are automatically generated by gradle. Therefore,
a bit more care needs to be taken when sharing a Android Studio project to an SVN repository.
The following instructions and guidelines will help you to properly share
your Android Studio projects via SVN and, in particular, not
to check in files to SVN, which should not be there.
Here is a list of folders and files from your Android Studio projects that should
NOT be shared:
-
build/
-
app/build/
-
.gradle/
-
.idea/libraries/
-
.idea/workspace.xml
-
local.properties
When you share an Android project from Android Studio via SVN, the order of
the steps in which you do that is very important:
- When the respective (not yet shared) project is open in Adroid Studio,
open the "Settings" dialog (File -> Settings...) and select and open
the "Version Control" category.
- In this category, select "Subversion" and the "General" tab. Uncheck all
checkboxes (in particular for box "Use command line client").
- Then select "Ignored Files" in the category "Version Control" and all
of the above folders and files to be ignored (using the "+" button
on the right side, and the pop up dialig which opens then).
- Once you have done that, you can enable version control for this project
(VCS -> Version Control Integration...) and select subversion in the
pop up dialog.
Note that this does not yet share the project to any repository, it
just enables the sharing via subversion for this project.
- Now you can share the project. To this end, right click on the top folder
of the project, select "Subversion > Share Directory...". In the opened
dialog, create a repository location (use the URL of the repository of your group);
and then select a folder in that repository. Make sure that the settings in
"Define share target" are
set correctly (you probably want to use
"In new "XXX" folder at selected repository location" or
"In new "XXX/trunk" folder at selected repository location". When asked
for fromat version, I recommend to use version 1.6.
- Then you can actually commit the project (right click on project folder,
Subversion -> Commit
Directory...). When you do that for the first time, it sometimes happens
that ignored files show up in the list of files and directories to be committed.
Then abort the commit, and first delete these files from the directory
(don't worry they will
automatically be created later again). And only after that do the commit.
And when they are recreated and appear for commit later again, mark them
to be ignored.
- When make changes in the future, you can simply commit them. But you
should always
check whether some of the file or folders that should be ignored, are on
the list of committed files. If that is the case, delete them again and only
after you did that do the commit (this will also delete them from the repository
in case they ended up there).
- Note that, in Android Studio, all changes you make will be added to a change
list for later commits. By default, there is a default change list; later
on, your can create other change lists, if you want; such lists can be used to
track changes that belong together and commit these changes together. To begin with,
the default change list is fine.
To import a project from a repository, you can use "File -> New -> Subversion"
and then selecting a respective folder in a repository. You might want to clean
up the ignored files (Settings -> Version Control, Ignored Files) after the import
and an intial build. And sometimes igorned files will end up on the list of committed files
again. In that case, make sure that you delete them again before you commit
them and mark them as ignored (right click on file, Subversion -> Ignore).
When you submit your Android Studio projects as some of the deliverables later
(e.g. technology experiment, 1st and 2nd prototype, and final submission), make sure
that non of the files and folders mentioned above are committed to the respective
folder for the tag (URL to the SVN repository) that you submit.
|