I have been looking all over to why i cannot use Gson in particular gsonFactory from any library i use.
I am using eclipse, my project has maven and I am running OS X
I am looking at this guide Authenticate with a backend server and whenever i try and create jsonFactory = new GsonFactory();
the GsonFactory cannot be resolved.
Now I have added several libraries as maven dependencies to no avail,
<dependency>
<groupId>com.google.api-client</groupId>
<artifactId>google-api-client</artifactId>
<version>1.20.0</version>
</dependency>
<dependency>
<groupId>com.google.http-client</groupId>
<artifactId>google-http-client</artifactId>
<version>1.19.0</version>
</dependency>
and also downloaded several jars but none of them resolve GsonFactory
.
That class is part of the GSON extensions to Google HTTP client library. So you just need to add a dependency for it. The current latest version is 1.21.0, so you could have:
<dependency>
<groupId>com.google.http-client</groupId>
<artifactId>google-http-client-gson</artifactId>
<version>1.21.0</version>
</dependency>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With