2

I just installed Android Studio and wondering how I could create an Android Library project. The solution shared in this post does not work anymore.

Update: I am not sure if this is enough to create a library project, but this are the steps I have done:

  1. Create a normal Android Project without an Activity
  2. Change apply plugin: 'com.android.application' to apply plugin: 'com.android.library' from build.gradle
  3. Delete the line applicationId "..." from build.gradle

If you would like to create a library as part of an application project, you could follow these steps based on this post:

  1. Go to File > New > New Module
  2. In the Create New Module window that appears, click Android Library
  3. Click Next
  4. Select a name and minimum SDK
  5. Click Finish
Community
  • 1
  • 1
Phidelux
  • 2,043
  • 1
  • 32
  • 50
  • I edited the one answer on that question to be more accurate for 1.0: http://stackoverflow.com/a/16665055/115145 – CommonsWare Dec 09 '14 at 13:40
  • As far as I understand, you explain how to create a multilib project. I was asking how to create a standalone library project. I updated my question with the steps I already have done to create such a project. Do I have to do something else or will this work? – Phidelux Dec 09 '14 at 13:57
  • Edited my answer to reflect latest changes in Android Studio. – Phidelux Jan 18 '17 at 13:01

1 Answers1

1

Accordingly to this document there is no such thing like 'Library project' or 'Application project'. There is 'Android project', which contains modules, and these can be application modules, library modules, test modules and so on.
I suggest you start with the project which consists of one library module. If later you'll find out that you need to add some tests, you'll add test module to this project. The same goes for the sample app which you'll someday (maybe) add to your library.
But, if for some reason you want to create plain library module, w/o any project, you can go with these three steps you described in your answer. I'm afraid there is no built-in support for creation of modules without underlying Android project.

aga
  • 27,954
  • 13
  • 86
  • 121