The best way to integrate third party library in Android studio

后端 未结 4 904
误落风尘
误落风尘 2020-12-04 17:55

We can find some very good open source libraries for android. I want to know what is the best way to integrate them to our own projects in Android studio. Here are some basi

4条回答
  •  天命终不由人
    2020-12-04 18:17

    1. Put the Gson jar (in my case, gson-2.2.4.jar) into the libs folder
    2. Right click it and hit 'Add as library'
    3. Ensure that compile files('libs/gson-2.2.4.jar') is in your build.gradle file
    4. Do a clean build (you can probably do this fine in Android Studio, but to make sure I navigated in a terminal to the root folder of my app and typed gradlew clean. I'm on Mac OS X, the command might be different on your system

    This series of steps was taken from Android Studio: Add jar as library? and is not my original answer. I am posting them here, again, because your question was the third in search results on Google when looking up this same topic. Hence, copying.

    All credits to the one who wrote the steps.

提交回复
热议问题