Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there an easier way to add gson to my project?

Tags:

android

How do I add gson to my project with gradle? I only see people adding files to their projects. I don't want to download the project and put it in mine.

like image 234
Jellies Avatar asked Apr 09 '15 21:04

Jellies


People also ask

How do I add a dependency in gradle?

To add a dependency to your project, specify a dependency configuration such as implementation in the dependencies block of your module's build.gradle file.


2 Answers

In app/build.gradle:

 dependencies {
    compile 'com.google.code.gson:gson:2.8.2'
}
like image 145
405 Freeway Avatar answered Oct 14 '22 07:10

405 Freeway


If you are using Android Studio you can use the following workflow instead of manually changing Gradle files:

  1. File -> Project Structure -> Modules -> app -> Dependencies Tab
  2. Click '+' in the bottom left corner and select "Library dependency"
  3. In the search field type: "gson" and click Search
  4. Select "com.google.code.gson:gson:2.8.5"

enter image description here

like image 38
Aniket Thakur Avatar answered Oct 14 '22 08:10

Aniket Thakur