Mou
Mou

Reputation: 2147

What is the best way of create and test a library project in Android Studio to share in any project?

In Android Studio 1.0.1 you only have the initial option of create a new project but not a new library.

I would like create a library that I can share with multiple and future apps.

Must I create a new project and create library modules inside?

Can create only a library project?

If a library only have a custom view... How I testing with AndroidTest using an Activity? (Activity should not compile into library)

Thanks.

Upvotes: 7

Views: 208

Answers (1)

atok
atok

Reputation: 5948

You are right, there is no option to create a library project using the initial wizard. The way I do it is to create an app module (using the wizard) and then add Android Library module using File -> New Module.

Most of the time I end up keeping the app module for testing and as an usage example of the library. I put all my tests (and other parts required for testing, like Activities) inside an app module to keep them separate of the library itself.

You can remove the initial app module by removing its name from settings.gradle and deleting the module directory.

Upvotes: 5

Related Questions