Read More

Create an Android Library

An Android library can include everything needed to build an app, including source code, resource files, and an Android manifest. However, instead of compiling into an APK that runs on a device, an Android library compiles into an Android Archive (AAR) file that you can use as a dependency for an Android app module.

Create a library module

  1. Click File > New > New Module.
  2. In the Create New Module window that appears, click Android Library, then click Next.There’s also an option to create a Java Library, which builds a traditional JAR file. While a JAR file is useful for many projects—especially when you want to share code with other platforms—it does not allow you to include Android resources or manifest files, which is very useful for code reuse in Android projects. So this guide focuses on creating Android libraries.
  3. Give your library a name and select a minimum SDK version for the code in the library, then click Finish.

 

Add your library as a dependency

Add the library to your project in either of the following ways (if you created the library module within the same project, then it’s already there and you can skip this step):

Make sure the library is listed at the top of your settings.gradle file, as shown here for a library named “my-library-module”:

Open the app module’s build.gradle file and add a new line to the dependencies block as shown in the following snippet:

In this example above, the compile configuration adds the library named my-library-module as a build dependency for the entire app module.

References:-> https://developer.android.com/studio/projects/android-library.html

. . .

Comment

Add Your Comment

Be the first to comment.

css.php
Hire Us!
Brief us about your requirements and we'll get back to you.
Woo! Hooy!
We have just recieved your project brief and our expert will contact you shortly.
Send Again
Close