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.
Android Studio is designed to make testing simple. It contains many features to simplify how you create, run, and analyze tests. You can set up tests that run on your local machine or instrumented tests that run on a device. You can easily run a single test or a specific group of tests on one or more devices.
Similar to the traditional Linux model, shared libraries in Android are relocatable ELF files that map to the address space of the process when loaded. To save memory and avoid code duplication, all shared objects shipped with Android are dynamically linked against the Bionic libc library [23].
Android Studio can be used to create an Android archive file (*. aar) that can contain classes and methods that make use of Android classes and related files. Like creating the Jar file, an Android project must be created first, then the Android library module can be created and added.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With