0

I have an old eclipse android workspace which has the following structure:

  • one library project which has all the code and default graphics and resources
  • other projects which depend on the library project, but with different package names, different strings.xml and different graphic resources.

Basically what this means is that all my code is in the Library Project, and all other projects are really just different apps, based on the same code, but looking differently with different names

All these were in one Eclipse workspace and now I need to update the project, so upgrading it to Android Studio sounds like the best way to go.

Alin
  • 14,809
  • 40
  • 129
  • 218
  • It's actually the only way to go. Eclipse is no longer supported. And even if it was, many of the libraries you need are not. For what it's worth, I moved like 15 projects from Eclipse to AS and had very little trouble. Just a little tweaking here and there. – durbnpoisn Oct 27 '16 at 20:34
  • I'm not sure about your shared libraries. At worst, you may end up with redundant libraries. But there is a good chance you can share them the same as before. – durbnpoisn Oct 27 '16 at 20:35

1 Answers1

0

The easy way is to hope that export works for your case. I battled with Eclipse->Studio migration for weeks. I had exactly that situation - one common project and other apps on top of it. Studio will just convert your common project into an Android library module, and other 'app' modules will be converted into Android app modules. Check out this answer: https://stackoverflow.com/a/22797387/2102748

When you're migrated, you should look to move your source files from the ant-style hierarchy to the gradle-style hierarchy. There is a lot of content for that here: http://tools.android.com/tech-docs/new-build-system/user-guide

Android Studio will also ask you to replace .jar libraries it knows about (like appcompat, google-play-services, etc) with gradle dependencies - do it. Life becomes so much easier.

Community
  • 1
  • 1
milosmns
  • 3,595
  • 4
  • 36
  • 48
  • Sorry for my late reply, can I simply create a new Android Studio project and add in it, the Library project as a module and other apps as 'app' modules and that's it? – Alin Nov 14 '16 at 17:19
  • You need build.gradle configuration files for every module (subproject) you have in order to properly import. It will be much much easier to import if that's an option. – milosmns Nov 14 '16 at 17:21
  • I was actually thinking of simply making a new project structure, similar to the eclipse workspace and after that add the java classes and resources to their corresponding places. – Alin Nov 14 '16 at 18:02
  • You _could_ do that, yes. But then it's better to follow Gradle project structures rather than Ant structures. Also, please post here how it went, i'm interested to hear about it :) – milosmns Nov 14 '16 at 18:36
  • Btw, watch out for VCS history if you're tracking your project somewhere. Simply moving files (cut & paste) will probably delete their previous version info. – milosmns Nov 14 '16 at 18:38