简体   繁体   中英

Project management IntelliJ IDEA / Android Studio

I'm just migrating to Android Studio, and I'm a bit confused about how to manage my projects / modules.

For example, in Eclipse I would have 3 projects:

  • Library project (has a couple of jar libraries)
  • App project 1 (uses the Library project, plus some other jar libraries)
  • App project 2 (also uses the Library project, plus some other jar libraries; does not use App project 1)

So if I understand correctly, I would create 2 projects in Android Studio, one for AP1, one for AP2, and in both projects I would add the Library project as a module?

When I do that, I suddenly get two Facets in the Library module called Android and Android2 . What does this mean?

Also, if I go a bit further, and add multiple libraries as modules, I get (in the Libraries tab under project settings) multiple libraries, libs , libs1 , libs2 . These may contain double jars, which AS complains about.

If anyone could clear some stuff up, that would be great. Thanks!

You can see a Module in Intellij as a Project in Eclipse.

And a Project in Intellij is the sum of modules that make your project run.

When you create a module from existing sources, Intellij will add it's module.iml configuration file to the specified location. Then all the configuration you have done on this Library module will be re-usable when importing this module in another Intellij project.

I know this post is quite old, but still I found it when facing similar problems as Niek. The structure of my project is similar to Niek's, with a Library, a "Full" app and a "Lite" app. The following describes what I did migrate from Eclipse Luna to Android Studio 1.0.2, with Android SDK 21.0.3. If this can help someone popping on that subject, It would make me a happy man!

  1. Create a Android Studio new project
  2. Select the "app" module, hit F4 to reach Module Settings
  3. Select "app" in the module settings and click the "-" button on top to remove it
  4. Manually delete the "app" folder in your project folder
  5. In the now empy project, go to "File" menu, select "Import module"
  6. Import your first dependency (ie customLibrary from the Eclipse project structure below) by selecting the folder from your Eclipse workspace
  7. do "F4" on the imported library, go to "Dependencies" tab, and add Google modules (ie appcompat-v7 from below)
  8. Do another "Import Module", selecting the "OwnLibrary" folder from your Eclipse workspace
  9. Fix dependencies in "Project Structure" by adding Google modules (here support-v4)
  10. Repeat the "Import Module" operation for App_1 and App_2
  11. Clean Project; it should rebuild and be ready.

If you have minSDKVersion issues, modify your different manifests. I found some answers about that Here and There

Eclipse Project structure

-MyProject-
+--OwnLibrary
  | +--support-v4
  | +--customLibrary
  |     +--appcompat-v7
  +-App_1
  |  +--OwnLibrary
  |-App_2
     +--OwnLibrary

ADDENDUM: When importing modules, if you changed the module name, there will be a few extra steps, ie:

  1. From that 8th point, after importing the OwnLibrary

    • "F4" on your library, select the "almost duplicate" folder, delete it by pressing "-" button on the top left.
    • Go to "Dependencies", remove the dependency with the name of the folder you removed.
    • Add a new dependency with the new folder name.
    • Manually delete the folder you removed from your project.

Thomas.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM