Add compile 'com.squareup.retrofit:converter-gson:2.0.0-beta2' to your build.gradle file and get the dependency resolved or add corresponding jars to your bulid path.

then use GsonConverterFactory.create() to get the Converter Factory

I tried using 2.0.0-beta1 but it gave me an illegal type conversion error for factory as given below, so moved to 2.0.0-beta2

  error: method addConverterFactory in class Builder cannot be applied to   given types;
    required: Factory
    found: GsonConverterFactory
    reason: actual argument GsonConverterFactory cannot be converted to Factory by method invocation conversion

So my suggestion is to use 2.0.0-beta2

my build.gradle has following dependencies to resolve retrofit.

 compile 'com.squareup.retrofit:retrofit:2.0.0-beta2'  
 compile 'com.squareup.retrofit:converter-gson:2.0.0-beta2'
Answer from manoj on Stack Overflow
🌐
Maven Repository
mvnrepository.com › artifact › com.squareup.retrofit2 › converter-gson
Maven Repository: com.squareup.retrofit2 » converter-gson
May 15, 2025 - A type-safe HTTP client for Android and Java. ... A Retrofit Converter which uses Gson for serialization.
🌐
GitHub
github.com › square › retrofit › blob › trunk › retrofit-converters › gson › README.md
retrofit/retrofit-converters/gson/README.md at trunk · square/retrofit
A Converter which uses Gson for serialization to and from JSON. A default Gson instance will be created or one can be configured and passed to the GsonConverterFactory to further control the serialization.
Author   square

Add compile 'com.squareup.retrofit:converter-gson:2.0.0-beta2' to your build.gradle file and get the dependency resolved or add corresponding jars to your bulid path.

then use GsonConverterFactory.create() to get the Converter Factory

I tried using 2.0.0-beta1 but it gave me an illegal type conversion error for factory as given below, so moved to 2.0.0-beta2

  error: method addConverterFactory in class Builder cannot be applied to   given types;
    required: Factory
    found: GsonConverterFactory
    reason: actual argument GsonConverterFactory cannot be converted to Factory by method invocation conversion

So my suggestion is to use 2.0.0-beta2

my build.gradle has following dependencies to resolve retrofit.

 compile 'com.squareup.retrofit:retrofit:2.0.0-beta2'  
 compile 'com.squareup.retrofit:converter-gson:2.0.0-beta2'
Answer from manoj on Stack Overflow
🌐
Futurestud.io
futurestud.io › tutorials › retrofit-2-adding-customizing-the-gson-converter
Retrofit 2 — Adding & Customizing the Gson Converter
November 10, 2016 - Google’s Gson is a very popular JSON converter. Almost every real-world JSON mapping can be done with the help of Gson. Once you’ve added the Gradle dependency to your project you’ve to activate it on your Retrofit instance.
🌐
GitHub
github.com › google › gson
GitHub - google/gson: A Java serialization/deserialization library to convert Java Objects into JSON and back · GitHub
If you still want to use Gson and attempt to avoid these crashes, you can see how to do so here. Provide simple toJson() and fromJson() methods to convert Java objects to JSON and vice-versa · Allow pre-existing unmodifiable objects to be converted to and from JSON ... Support arbitrarily complex objects (with deep inheritance hierarchies and extensive use of generic types) ... <dependency> <groupId>com.google.code.gson</groupId> <artifactId>gson</artifactId> <version>2.13.2</version> </dependency>
Starred by 24.3K users
Forked by 4.4K users
Languages   Java
🌐
Medium
medium.com › @zorbeytorunoglu › gson-on-android-9a6c34cb7044
Gson on Android | Medium
May 18, 2024 - Simplicity: Gson provides a simple API for serialization and deserialization, making it easy to convert between JSON and Java/Kotlin objects.
🌐
Maven Central
central.sonatype.com › artifact › com.squareup.retrofit2 › converter-gson
converter-gson - com.squareup.retrofit2 - Maven Central
A Retrofit Converter which uses Gson for serialization. ... <dependency> <groupId>com.squareup.retrofit2</groupId> <artifactId>converter-gson</artifactId> <version>3.0.0</version> </dependency>
🌐
Okio
square.github.io › retrofit › configuration
Configuration | Retrofit
Converters can be added to support other types. Sibling modules adapt popular serialization libraries for your convenience. ... Here’s an example of using the GsonConverterFactory class to generate an implementation of the GitHubService interface which uses Gson for its deserialization.
Find elsewhere
🌐
Codepath
guides.codepath.org › android › leveraging-the-gson-library
Leveraging the Gson Library | CodePath Android Cliffnotes
This library helps to avoid needing to write boilerplate code to parse JSON responses yourself. It can be used with any networking library, including the Android Async HTTP Client and OkHttp. Add the following line to your Gradle configuration: dependencies { implementation 'com.google.cod...
🌐
Medium
medium.com › @pypriyank › consuming-rest-api-in-android-using-retrofit-and-gson-20268aadf0eb
Consuming REST API in android using Retrofit and GSON. | by Priyank Kumar | Medium
March 28, 2020 - Now let’s get into our android project. The First thing we are going to do is add retrofit and GSON library to our build.gradle (Module:app) > dependencies. Add the following to the dependencies block: implementation 'com.squareup.retrofit2:retrofit:2.8.0' implementation 'com.squareup.retrofit2:converter-gson:2.8.0'
🌐
Jar-Download
jar-download.com › home › com.squareup.retrofit2 › converter-gson › 2.3.0 › source code › gsonconverterfactory.java
retrofit2.converter.gson.GsonConverterFactory Maven / Gradle / Ivy
September 13, 2022 - If you are mixing JSON serialization with something else (such as protocol buffers), * you must {@linkplain Retrofit.Builder#addConverterFactory(Converter.Factory) add this instance} * last to allow the other converters a chance to see their types. */ public final class GsonConverterFactory extends Converter.Factory { /** * Create an instance using a default {@link Gson} instance for conversion.
🌐
Medium
chaitanyaduse.medium.com › android-room-typeconverter-how-to-pass-dependency-to-type-converter-ec4cbcf674d2
Android Room TypeConverter - 3 How to pass dependency to Type Converter ? | by Debug Labs | Medium
June 11, 2025 - Provide instance to the database builder using the builder method addTypeConverter(GsonConverter(gson)) Register it at appropriate scope — Database, Entity or field (More about scopes here — TypeConverter Scopes ... 🚀 Android Dev (13+ yrs) | Jetpack Compose | AI & ML Enthusiast | Writing on Background Work, Room DB, Clean Architecture & more | Simplifying dev concepts
🌐
Jar-download
jar-download.com › maven-repository-class-search.php
Download dependencies for java class retrofit2.converter.gson.GsonConverterFactory
September 4, 2019 - Here you can download the dependencies for the java class retrofit2.converter.gson.GsonConverterFactory. Use this engine to looking through the maven repository.
🌐
Maven Central
central.sonatype.com › artifact › com.squareup.retrofit2 › converter-gson › 2.9.0
com.squareup.retrofit2:converter-gson:2.9.0 - Maven Central
A Retrofit Converter which uses Gson for serialization. ... <dependency> <groupId>com.squareup.retrofit2</groupId> <artifactId>converter-gson</artifactId> <version>2.9.0</version> </dependency>
🌐
Maven Repository
mvnrepository.com › artifact › com.squareup.retrofit2 › converter-gson › 2.10.0
Maven Repository: com.squareup.retrofit2 » converter-gson » 2.10.0
March 19, 2024 - A Retrofit Converter which uses Gson for serialization. ... aar android apache api application arm assets build build-system bundle client clojure cloud config cran data database eclipse example extension framework github gradle groovy io ios javascript kotlin library logging maven mobile module npm osgi plugin resources rlang sdk server service spring sql starter testing tools ui war web webapp
🌐
Medium
medium.com › @KaushalVasava › retrofit-in-android-5a28c8e988ce
Retrofit in Android. In the world of Android app… | by Kaushal Vasava | Medium
November 30, 2024 - Retrofit requires a minimum Java 8+ or Android API 21+. ... implementation 'com.squareup.retrofit2:retrofit:2.9.0' implementation 'com.squareup.retrofit2:converter-name:2.9.0' /*converter-name tends to any one from listed conververts*/ ... implementation 'com.squareup.retrofit2:retrofit:2.9.0' implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
🌐
GeeksforGeeks
geeksforgeeks.org › difference-between-gson-and-json-in-android
Difference Between GSON and JSON in Android | GeeksforGeeks
September 13, 2022 - It allows pre-existing unmodifiable objects to be converted to and from JSON · It also provides extensive support for Java Generics ... GSON supports arbitrarily complex objects (with deep inheritance hierarchies and extensive use of generic ...
🌐
DhiWise
dhiwise.com › post › kotlin-gson-for-effective-json-handling
Kotlin GSON Guide: Simplifying Data Serialization
December 31, 2024 - It is widely used in Android projects and Kotlin applications because it can handle complex JSON data structures, including nested objects and arrays. To start using GSON, you must add it as a dependency in your Kotlin ...