Search code examples
androidandroid-studioandroid-gradle-pluginandroid-library

External library in my library


I am building a android library using android studio. I would like to know if there is a way to include other external library dependencies to my library.

Say I want to use OkHttp library, but I don't want users of my library to use that dependency in their gradle explicitly.

I searched for couple of hours but couldn't find any useful information. Can anyone help, it would be of great help even if you could give some useful links.

Thank you in advance.


Solution

    1. Put the jar into the libs folder.

    2. Right click it and hit 'Add as library'

    3. Ensure that compile files('libs/lib_name.jar') is in your build.gradle file

    4. Do a clean build.