12

OK I know people have asked this problem thousands times, but Android studio is so so so hard to understand and use and I still can't find the correct way.

I find several solutions, but all of them says to copy the library codes into main project. It makes no sense to me. When I try to build a standalone project for the library, I find no "New project from existing source" like that in Eclipse.

Can I have a step-to-step for:

  1. I have a main Android Studio project
  2. I have an Eclipse Android library project
  3. Without making a copy of library project
  4. I can let the main project "use" library project

The point is, if I have many app projects using the same library source, I can just modify one copy. If I need to put library codes in every app project, it's a disaster. Eclipse can do this without any problem.

Thank you. I'm really exhausted with Android Studio, but I can't choose to stay on Eclipse since Google says ADT won't be supported anymore.

Romulus Urakagi Ts'ai
  • 3,699
  • 10
  • 42
  • 68

3 Answers3

7

The real answer to keep your library project only in one place is in this post :

Android Studio 0.8.1 Creating Modules without copying files?

Community
  • 1
  • 1
tchoum
  • 312
  • 1
  • 2
  • 10
0

In Android Studio Project import your eclipse library project as new module. Then in Android studio right click on your app module go to module setting > select dependency tab > click plus> select module dependency > select library project module.

Pr38y
  • 1,565
  • 13
  • 21
  • This will make a local copy of library. – Romulus Urakagi Ts'ai Feb 10 '15 at 06:11
  • If you want to use a library project in eclipse you have to import it first, without importing you can't use it. Similarly If you want to use a library project in android studio you have to import it as a module first. No this will not make a local copy of library. – Pr38y Feb 10 '15 at 06:47
  • It's OK to make a copy project for Android Studio, but under file system I find a full library copy in main project's folder. Can I move the library out? If I can, is it possible to use moved out library in other projects? – Romulus Urakagi Ts'ai Feb 10 '15 at 06:51
  • You may need to convert your library project into gradle based project. Follow the same procedure you followed for your project. In android studio one project is kind of eclipse workspace and projects of eclipse are similar to module in Android Studio. – Pr38y Feb 10 '15 at 06:52
  • Yes you can use same module in multiple project but you cannot move out one module from a project if there is any dependency. – Pr38y Feb 10 '15 at 07:01
  • You can follow more about gradle from http://rominirani.com/2014/07/28/gradle-tutorial-series-an-overview/ – Pr38y Feb 10 '15 at 07:02
-1

new Module or import Module under the project,
then open Module Settings--》Module dependencies --》‘+’ module dependencie.

KillNono
  • 282
  • 4
  • 4