Create an Android Library

Save

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

. . .

Leave a Comment

Your email address will not be published. Required fields are marked*


Be the first to comment.

css.php

We've bought a Shopware Extension which is a hybrid App, which we can now offer in the Google Play Store and the IOS App Store. I'am still impressed how fast and how sharp the support team leads us through every process of the App-Store clarification. Very fast and useful response.

Markus Walter

Markus Walter

Founder, Das Apartment Living

Talk to Sales

Global

Live Chat
Start a Project


    Message Sent!

    If you have more details or questions, you can reply to the received confirmation email.

    Back to Home