By   June 5, 2014

In this short post we will be learning how we can add a JAR library to our project in Android Studio. Here we are using Android Preview 0.5.4 edition.

Let’s use Gson library. This is used to serialize / deserialize java objects to JSON format. Please see the license requirements before using in your project.

DownloadGson

Just download it from the above location from Google Code and copy it to the lib folder of your project. As you copy it to the folder you would see this dialog opened. You can just hit OK here.

CopyGsonToLibFolder

We need to update the build file (build.gradle) to include the lib for building the project. You don’t have to worry anymore as Android studio now includes everything form the lib folder now.

buildGradle

Now just make sure that you clean the project before using the types from the library.

CleanProject