Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the right way to import an Android Studio project in a SVN repository?

I'm trying to import an Android Studio project in my SVN repository. I obiviously tried

VCS->Import into Version Control->Import into Subversion...

but the problem is that, even unchecking the Include ignored resources box, the software keeps uploading basically all the files in the project folder to SVN. I also tried to do Share Project (Subversion) and it doesn't upload anything (just creates the remote folder): when i try to commit, it wants to upload all files like the import option.

I also tried to play a bit with the svn:ignore property, but with not much luck.

My questions are:

  1. What's the best way to do this?
  2. Shouldn't Android Studio automatically take care of these things? If no, why?

Thanks for the help.

like image 966
MMauro Avatar asked Jan 11 '15 13:01

MMauro


4 Answers

I followed these steps and I have successfully imported the android project into subversion repository.

(1) Enable VCS integration (under the VCS)

(2) Settings -> Version Control -> Ignored Files (add the files, folders in your .gitignore file here) - It should be like below image. After this you can see the ignored files in separate color(like yellow) and other files that need to add to subversion in another color(red)

Type intellij here and it will give you the ignored file list

enter image description here

(3) VCS -> Import Into Version Control -> Import into Subversion (I'm using subversion).Select the parent folder, not app folder.

(4) In the dialog uncheck 'Include ignored resources' then import

(5) Finally Checkout the project into the same project folder. After this the color of the files(red) that were added to remote repository will be disappeared.

Note: You can create a new remote folder after giving the repository location(VCS -> Browse VCS Repository -> Browse Subversion Repository)

like image 184
chathura Avatar answered Nov 16 '22 19:11

chathura


You're on the right track, the svn:ignore is a template/list to define files that subversion should ignore. If you're doing this on Windows I suggest using free TortoiseSVN client that has a nice explorer-integrated GUI to make life much easier. It's just right click on a file -> TortoiseSVN -> add to ignore list.

Also, just found a post here that has the actual svn:ignore list for your projects: What files should I add to SVN ignore in an Project using Android Studio

Edited, as per comments, adding the list:

gradle
.idea
*.iml
build
.DS_Store ( => for mac only)
like image 5
Lucius Avatar answered Nov 16 '22 20:11

Lucius


Adding a contrary opinion; I found that the ignore files was the wrong approach. Importing into SVN seemed to completely ignore the Ingore list and checked in everything..

I used Tortoise SVN which recommends not to use import, and to Import in Place

In Tortoise explorer popup:

  • TortoiseSVN -> Browse Repository: Create a folder in the repository to be your project root.
  • TortoiseSVN -> Checkout: Checkout the root folder over the project root (and ignore the warning that you are checking out into a non-empty directory.)
  • On build folder -> TortoiseSVN -> Add to Ingore List (Probably not strictly needed, but makes the following step much easier with fewer generated files.)
  • TortoiseSVN -> Add which then lets you pick individual directories and files. This was the best list of files/directories to ignore.

Then in Android Studio:

  • (Enable VCS Features in VCS menu if not enabled already)
  • Commit Changes, which will sync the file status and seems to pickup the files that were in the Add change list from Tortoise. (My flailing around with above answers may have gotten AS in a weird state, so hopefully this will be available for you!)
like image 4
Jay Avatar answered Nov 16 '22 21:11

Jay


These steps worked for me (using a Mac):

  1. Enable VCS Integration
  2. Setup ignore files in Android Studio / Preferences / Version Control / Ignored Files Directory: .gradle/ Directory: .idea/ Mask: *.iml Directory: build/ Mask: .DS_Store Directory: app/build/

  3. Upper left hand corner, change dropdown from ‘Android’ to ‘Project’

  4. Close / reopen your project in Android Studio. Make sure the ignored files are not in red.
  5. Right click on project name, click on Subversion / Share Directory
  6. Choose correct target path, choose 1.6
  7. You should get a prompt telling you to commit to complete the process.
  8. Right click on project, Subversion / Commit Directory, Commit
like image 4
richieholes Avatar answered Nov 16 '22 20:11

richieholes