Posts Tagged ‘Eclipse’

Converting Eclipse Android Project with Libraries and VCS to AndroidStudio

Friday, February 20th, 2015

This thing puzzled me for a while. I have several separate libraries in eclipse and their associated SVN directories. I

  1. Did not want to duplicate sources in the repo
  2. Wanted everything under source control
  3. Wanted to use Gradle (because that seems to be Google’s preferred source build system for android)
  4. Did not mind having everything in one project instead of separate modules in Android Studio ((un)like I had in eclipse)

So what I did was the following:

  1. Import project from Eclipse by choosing ‘Import from eclipse’ from the main AndroidStudio window.
  2. Go into the project and for all sub-projects in AndroidStudio open the Java folder and delete the Java source tree (i.e. the Java directory should be empty)
  3. Warning for the next step; in your repository, make sure to create a directory for your project. Do not import into the root or it will be a mess!
  4. Check in your (now empty) android studio project by going to (Toolbar) VCS->Subversion->Share Project. So your, Android project, will be under source control in its own folder.
  5. Now for every subproject click on (Toolbar) VCS->Checkout->Browse to the root of your source (i.e. the last part of your domain name, for me it is ‘eu’)
  6. Browse to your project, subproject and then the java folder.
  7. Press Checkout
  8. Choose the option with the last directory being Java followed by the first part of your domain name (i.e. in my case again ‘eu’). So for me …Java/eu
  9. Then select ‘NO’, do not create an android studio project from it.

You should be all set. When you now commit the project itself it will go into its VCS location while the subprojects will update the existing VCS project locations.

Bonus points for anyone who figures out to do this, but then with a separate android studio project for every library. 🙂