How to add Gson library to Android Studio project

Google Android Studio from my point of view is the most suitable IDE for native Android programming. It is simply works out of the box. However, during working with this IDE, I have faced the shortage of documentation. Unfortunately, majorities of tutorials have been written for Eclipse IDE and since Android Studio in comparison is considered as new, the lack of documentation is quite obvious especially for beginners like me. For instance, I was seeking on the net about adding Gson (or any other) library to Android Studio and didn’t find a suitable document for that. Finally, I have randomly found it by chance.

Adding libraries in Android Studio is fairly easy in overall. In this example, I explain about importing Gson lib to Android project. In order to add library click on File menu from Android Studio and select Project Structure like the following picture,

Android

Then from the pop up menu select Dependencies tab like this

Dependencies

And then click on “+” and choose you Gson library like below,

Lib

After that click on OK and close the tab. Now you can start using Gson library in your project.

2 Comments

Leave a Reply