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

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

I would like to create a library that I can provide with several and future applications.

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

Can only create a library project?

If the library has only a user view ... How do I test AndroidTest with Activity? (Activity should not be compiled into a library)

Thanks.

+7
android android-studio android-library
source share
1 answer

You are right, there is no way to create a library project using the original wizard. How I do this is to create an application module (using the wizard) and then add the Android library module using File -> New Module.

In most cases, I end up supporting the application module for testing and as an example of using the library. I put all my tests (and other parts necessary for testing, for example, "Actions") into the application module so that they would not separate from the library itself.

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

+5
source share

All Articles