In this tutorial,we will learn that how to create Android SDK or Android Library in android studio step by step.
What do you mean by Android SDK ?
An Android SDK or Android Library is same as android app module.It contains the source codes,resources file and android manifest.
However,instead compiling into APK that runs on device.But Android SDK/Android Library compiles into AAR(Android Archives Resources) that can be used as a dependence in Android app module.
Why use Android SDK ?
1.One singe Android SDK can be integrated with the multiple android application.
2.Time saving,code re-usability
How to Create Android SDK or Android Library
1. Click File > New >New Module
2.In the Create New Module window that appear,Click Android Library,then click Next.
3. Give your library name and select minimum SDK version,then click finish.
Wait for sometimes,to synchronise your gradle after that you will see the android library( module name) left side of your project.
When click on android library(module name),you will see the manifest,java codes,resources etc same app module.
Now,suppose you are developing Android SDK then how you can check your Android SDK functionality which you are developing at every step.
In the app module ,you have to move java class (MainActivity.java) to the java class of Android SDK as you want to open using Intent.
Intent intent=new Intent(MainActivity.this,SdkActivity.class); startActivity(intent);
MainActivity-It is the app module java class
SdkActivity-It is an Android sdk java class.
I hope that you have completed your Android SDK.Now how you can Export your android SDK file.
How to generate AAR file
To build AAR file,Select the module library in the project window and then click on Build > Make “module_name“.
Note:Here module_name will show the name of module/library as you will keep the name of module/android library.
How to get AAR file
1.Go to the local/computer storage where your android studio project is located.
2.After that you will see your android SDK/Library name.
3.Click on the your Library name folder
4.Click on ‘build’ folder
5.Click on ‘output’ folder
6.Click on ‘aar’ folder
7.After that you will see .aar file.
Hello friends,i have explained everything step by step.If you want more details about android sdk or android library.
Visit official website:https://developer.android.com/studio/projects/android-library