Videos
I remembered how to do this really quickly. You have to go to File -> Project Structure. Then click the Libraries tab and the green plus. Once clicked select from Maven and then search GSON and find the correct GSON version you want to use from the menu and then GSON dependency will work.
I had the same issue.
Go to File -> Invalidate Caches/ Restart and click the same again.
Android Studio restarts and reloads all your library files.
Add following dependency to build.gradle:
implementation 'com.google.code.gson:gson:2.11.0'
Or download the JAR file from Maven by clicking a release and finding the .jar file.
Replace 2.8.7 with the latest version from Maven.
Visit the GitHub repo for documentation and more.
Read Google-gson
Gson is a Java library that can be used to convert Java Objects into their JSON representation. It can also be used to convert a JSON string to an equivalent Java object.
Add the following line to your MODULE LEVEL build.gradle configuration:
dependencies {
implementation 'com.google.code.gson:gson:2.11.0'
}