Cannot resolve import com.google.api.client.json.gson.GsonFactory

Am trying to use the GsonFactory class in my app:

StudentApi.Builder builder = new StudentApi.Builder(AndroidHttp.newCompatibleTransport(), new GsonFactory(), null);

but it says cannot resolve symbol 'GsonFactory'

I have the import in my class

import com.google.api.client.json.gson.GsonFactory;

but gson couldn't be resolved so I tried Alt-Enter - Find jar on web but the library couldn't be found.

I have this in my build.gradle dependencies:

dependencies {
   ...
   compile 'com.google.code.gson:gson:2.3'
   compile 'com.google.api-client:google-api-client-android:1.19.0'
}

I can confirm that this class does exist.

You need to use this library:

compile 'com.google.http-client:google-http-client-gson:1.19.0'

google-http-java-client/GsonFactory.java at master · googleapis , NetHttpTransport; import com.google.api.client.json.gson.GsonFactory;. but I am getting the next error message: "com.google.api cannot be resolved to a type". GSON Extensions to The Google APIs Client Library For Java. GSON Extensions to The Google APIs Client Library For Java License: Apache 2.0: Tags: google json client api:

GsonFactory is from the older version.

Now, you should use JacksonFactory.getDefaultInstance() instead.

Import it like this import com.google.api.client.json.jackson2.JacksonFactory;

External Libraries Compilation · Issue #369 · google/j2objc · GitHub, Download the latest zip file, which you can find on the downloads page, and extract If you are using the Google API Client Library for Java with Android, it is important to google-http-client-android-1.32.1.jar; gson-2.8.6.jar  The following are top voted examples for showing how to use com.google.api.client.json.gson.GsonFactory.These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.

In your gradle.build you need to add:

compile ('com.google.http-client:google-http-client-gson:1.19.0') {
    exclude module: 'httpclient'
}

after

compile('com.google.http-client:google-http-client-android:1.19.0') {
    exclude(group: 'com.google.android', module: 'android')
}

After doing so, you will be able to use:

com.google.api.client.json.gson.GsonFactory()

Setup Instructions | API Client Library for Java, com.google.api.client.json.gson.GsonFactory. public class GsonFactory extends JsonFactory. Low-level JSON library implementation based on GSON. mais il dit cannot resolve symbol 'GsonFactory' J'ai l'importer dans ma classe. import com. google. api. client. json. gson. GsonFactory; mais gson ne pouvait pas être résolu j'ai donc essayé Alt-Enter - Find jar on web mais la bibliothèque n'a pas pu être trouvé. J'ai cela dans mon build.gradle dépendances:

this object is only in older versions of the google-http-client try whit the 1.9.0-beta version

compile 'com.google.http-client:google-http-client-android:1.9.0-beta'

files.get and .getRequestFactory cannot be resolved, Dismiss Join GitHub today. GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.

GsonFactory (google-http-java-client 1.35.0), Version of google-api-java-client (e.g. 1.5.0-beta)? 1.6.0-Beta Java environment (e.g. Java 6, Android 2.3, App Engine)? Java 6, Android 2.2 Describe the problem. In the YouTube Sample code, when creating the final jsonFactory = new JacksonFactory(), I get a runtime exception on the Android emulator saying class not found, JacksonFactory.

не удается разрешить импорт com.google.api.client.json.gson , Contribute to google/google-api-java-client-samples development by creating an account on GitHub.

files.get and .getRequestFactory cannot be resolved, Hi, The article you referred is old and the steps have changed. Better approach would be to use the latest version of Selenium and GeckoDriver if you want to run your scripts on Firefox.

Comments
  • You can also use JacksonFactory if possible. stackoverflow.com/questions/17231722/…
  • You can also use JacksonFactory() in lieu of GsonFactory for those API builders if there is some trouble with the dependency.
  • One more comment: For some reason if using the maven dependency doesn't download the Gson library -- you can just include the library manually. central.maven.org/maven2/com/google/api-client/…