How to release Android SDK with third-party dependencies?

I developed an Android SDK to use our soothing API. In my SDK, I used third-party libraries like retrofit2 and rxandroid.

dependencies { compile 'io.reactivex:rxandroid:1.2.1' compile 'com.squareup.retrofit2:retrofit:2.0.2' compile 'com.squareup.retrofit2:converter-gson:2.0.2' compile 'com.squareup.retrofit2:adapter-rxjava:2.0.2' } 

I released the aar file to my client. His application imported my aar file and directly used my service, which was implemented by retrofit2 to use the API. The problem is that his application should also include the dependencies of retrofit2 and rxandroid in the dependency section. Is there a way to allow my client to directly use my service without adding dependencies in the dependency section? because I don’t want my client to know which libraries I used in my SDK.

Thanks in advance.

+3
android rx-android retrofit2
source share
1 answer

As far as I know, you cannot include aars inside aar. They do not have configuration files that indicate the dependencies that they need. You can either

Number two is preferable since all your clients will need to include a link such as compile 'com.abc.efg:version' in order to capture all the dependencies. This is also a much better option, because there are ways to deal with version conflicts (for example, with an exclude group ).

Imagine that your client used a different sdk that was engaged in a different version of the modification. If your aran was provided to them using the first method, they won’t even be able to build the project at all due to version conflicts. However, with the second version, they can just do

 compile ('com.abc.efg:version') { exclude group: 'com.squareup.retrofit2' } 

and be free from all this headache. A real life example is the Facebook SDK. It attracts google gaming services, but people often already include this as a dependency on their project and run into problems like this .

+1
source share

All Articles