How to import an external library in Android studio?

Why is it so hard to import libraries in Android development (Android Studio)?

  • I've spent hours trying to figure out how to simply import an Android library hosted on Github into my project. It's a nightmare with so many weird configurations I have to set and mysterious tribal knowledge on where to put the library so that my project can use it. Why is this process so hard and frustrating? Doesn't this put Android at a significant disadvantage in the open-source community? Why make code hard to share? For contrast, including a ruby library into my ruby application is as simple as adding a dependency to my Gemfile, and running "bundle install". Boom, done.

  • Answer:

    Well I think it is not that difficult to import compiled jar libaries into Android Studio (0.4.4) > Put the compiled .jar file into your application's /libs folder. > Edit build.gradle in your application's folder and insert "compile files ('src/main/libs/<your library.jar file')" into dependencies {} > Then run clean project and then re-build project

Sudara Madushan Fernando at Quora Visit the source

Was this solution helpful to you?

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.