Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create a sdk in android studio

I have developed a small application using android studio. The app part is basically a sample UI as the main purpose is to provide the SDK which can be used by different applications. How do I do this separation? As in how can I make my UI part a different project which uses my libraries by importing them as we import a jar.

Thanks in advance!!

like image 937
Sid Avatar asked Dec 12 '15 10:12

Sid


1 Answers

An SDK is a "Software Development Kit" - code that you provide to someone else that they use.

That means it is like a "library" which you can choose to distribute in a number of ways. The most popular ways to distribute a library is as a "jar" (which you mention) or "aar". You can also provide a github or other repo location that your developers/users can clone.

With Android Studio, the only important point here is that in you build.gradle file you specify:

apply plugin: 'com.android.library'

When you do a "gradle build" you will have an aar in your "build->outputs" directory. There may be other things you want to do (Proguard or build a jar) that you can explore.

However in your build.gradle do not use:

apply plugin: 'com.android.application'

That will create an APK - which is not something you can distribute as an SDK.

Also, for your testing purposes, you will need a separate project from your SDK that actually is an application. This will help you "pretend" to be a third-party developer/user.

like image 163
Jim Avatar answered Sep 29 '22 04:09

Jim