dependencies {
    compile 'com.google.code.gson:gson:2.8.1'
}

To use latest version of Gson

The below line will compile latest version of gson library everytime you compile, you do not have to change version.

Pros: You can use latest features, speed and less bugs.

Cons: It might break compatibility with your code.

compile 'com.google.code.gson:gson:+'