Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Migrating SVN to Android Studio

I'm migrating my Android project from Eclipse to Android Studio. I use Subversion and am wondering how I can migrate my SVN to the new file structure used in Android Studio without losing my history.

Thanks for any help!

like image 834
DalvikDroid Avatar asked Aug 11 '14 16:08

DalvikDroid


1 Answers

Posting this because it might help someone else.

I ran into the same problem as well. @user714965 was inspiring but didn't solve my problem because I couldn't figure out how to get SVN recognize that I moved a file from the original folder to the new structure in my working copy.

For the following, you will need TortoiseSVN or a similar SVN GUI client to do this.

Here is what I did:

  1. Commit the Eclipse project last changes into the SVN repo.
  2. Open Android Studio and use that to import the Eclipse project working copy.
  3. Android Studio will nicely convert the Eclipse project into a Android Studio/Gradle project. Let's call this project "PrjGradle".
  4. Open the converted Gradle project folder window and keep it one side of your screen
  5. Go into your SVN repo where you have your project (using TortoiseSVN).
  6. Backup your current trunk into a branch or a tag and call it "final_eclipse" or whatever.
  7. Now, mirror the folder structure of the newly converted Gradle project on your local machine directly on the TortoiseSVN Repo Browser window. Meaning, look at how the directory is structured in "PrkGradle" and create/delete/rename folders directly on the trunk repository. This will be painstakingly tedious but you have to bear with it if you want to preserve your SVN history.
  8. When you move files around (not copy) directly on the repo, the history of the files remain intact.
  9. Once you complete, check out the restructured directory into your local machine. Let's call this "NewPrj".
  10. Use a suitable Folder compare program (such as Beyond Compare) to synchronize missing items (such as build.gradle, .iml files, etc.)
  11. Rename your converted project to "PrjGradle_old", and rename the newly checked out project (NewPrj) to "PrjGradle".
  12. Open "PrjGradle" in Android Studio. That's it!

Hope it works out.

like image 135
Arlyn Avatar answered Oct 20 '22 19:10

Arlyn