- I have a Android app and now I have to make a SDK form the app. So other apps can use my SDK by just putting a compile time dependency I dont find many sources in Internet can some one please help me in this regard.I am using Andorid Studio
- I want to build a SDK similar to MobiHelp SDK see this link : https://github.com/freshdesk/mobihelp-android
Asked
Active
Viewed 2,330 times
2

Spiker
- 522
- 4
- 21
-
Create your project as library in Android Studio. – Sandeep Londhe Jul 15 '16 at 08:24
-
2You want to create an android library project, e.g. here is a Tutorial: http://www.vogella.com/tutorials/AndroidLibraryProjects/article.html – thaussma Jul 15 '16 at 08:25
1 Answers
1
If your SDK is an Android-Library, declare
apply plugin: 'com.android.library'
instead of
apply plugin: 'com.android.application'
in the corresponding build.gradle
. You will get an .aar-File (Android ARchive) that would need to be refereced from others in order to use your SDK.
If your SDK is a plain-old-java-Library (no Android resources) you also can use Maven to package it as jar.

sschrass
- 7,014
- 6
- 43
- 62
-
aar can also be used with Maven. And there is a [project on GitHub](https://github.com/adwiv/android-fat-aar) that makes it easier to wrap few libraries together into one aar. – Alex Cohn Jul 15 '16 at 11:23
-
@sschrass I had created a .aar file, when I tried to import the library in other Project its not building and throwing this error in Message Gradle Attribute application@icon value=(@drawable/ic_launcher) from AndroidManifest.xml:8:9 Attribute application@theme value=(@style/AppTheme) from AndroidManifest.xml:10:9 is also present at Amazon:zupvendor:unspecified:37:9 value=(@style/AppTheme.NoActionBar) – Spiker Jul 15 '16 at 15:46
-
http://stackoverflow.com/a/27360988/1087479 try this. Both manifests (app and lib) define the same thing. – sschrass Jul 15 '16 at 15:51
-
my aar file cant include dependencies in sdk gradle file. if project using my aar it get error: "java.lang.NoClassDefFoundError: Failed resolution of: Lio/reactivex/Observable" – Hoang Duc Tuan Dec 18 '19 at 02:32