If you are not using a generated library, you can download the Google API Client Library for Java and its dependencies in a zip file, or you can use Maven.
Also see the ProGuard setup instructions that are part of the Google HTTP Client Library for Java documentation.
Download the library with dependencies
Download the latest zip file, which you can find on the downloads page, and extract it on your computer. This zip file contains the client library class jar files and the associated source jar files for each artifact and its dependencies. You can find dependency graphs and licenses for the different libraries in the dependencies folder. For more details about the contents of the download, see the readme.html file.
Android
If you are developing for Android, and the Google API you want to use is included in the Google Play Services library, use the Google Play Services library for the best performance and experience.
If you are using the Google API Client Library for Java with Android, it is important to know which dependencies are compatible with Android, specifically which Android SDK level. Android applications require the following jar files, or newer compatible versions, from the libs folder:
- google-api-client-2.4.0.jar
- google-api-client-android-2.4.0.jar
- google-oauth-client-1.34.1.jar
- google-http-client-1.42.2.jar
- google-http-client-android-1.42.2.jar
- gson-2.9.0.jar
- jackson-core-2.13.3.jar
- jsr305-3.0.2.jar
- protobuf-java-3.21.4.jar
Google App Engine
Google App Engine applications require the following jar files, or newer compatible versions, from the libs folder:
- google-api-client-2.4.0.jar
- google-api-client-appengine-2.4.0.jar
- google-api-client-servlet-2.4.0.jar
- google-oauth-client-1.34.1.jar
- google-oauth-client-appengine-1.34.1.jar
- google-oauth-client-servlet-1.34.1.jar
- google-http-client-1.42.2.jar
- google-http-client-appengine-1.39.2.jar
- gson-2.9.0.jar
- jackson-core-2.13.3.jar
- jdo2-api-2.3-eb.jar
- jsr305-3.0.2.jar
- protobuf-java-3.21.4.jar
- transaction-api-1.1.jar
- xpp3-1.1.4c.jar
Servlet
Servlet applications require the following jar files, or newer compatible versions, from the libs folder:
- google-api-client-2.4.0.jar
- google-api-client-servlet-2.4.0.jar
- google-oauth-client-1.34.1.jar
- google-oauth-client-servlet-1.34.1.jar
- google-http-client-1.42.2.jar
- commons-logging-1.2.jar
- gson-2.9.0.jar
- httpclient-4.5.13.jar
- httpcore-4.4.12.jar
- jackson-core-2.13.3.jar
- jdo2-api-2.3-eb.jar
- jsr305-3.0.2.jar
- protobuf-java-3.21.4.jar
- transaction-api-1.1.jar
- xpp3-1.1.4c.jar
Generic Java
General purpose Java applications require the following jar files, or newer compatible versions, from the libs folder:
- google-api-client-2.4.0.jar
- google-oauth-client-1.34.1.jar
- google-http-client-1.42.2.jar
- google-http-client-jackson2-1.39.2.jar
- commons-logging-1.2.jar
- gson-2.9.0.jar
- httpclient-4.5.13.jar
- httpcore-4.4.12.jar
- jackson-core-2.13.3.jar
- jsr305-3.0.2.jar
- protobuf-java-3.21.4.jar
- xpp3-1.1.4c.jar
Generated libraries for Google APIs
The repository of the generated libraries has instruction on how to use each version of the APIs.
Maven
The Google API Client Library for Java is in the central Maven repository.
The Maven groupId
for all artifacts for this library is com.google.api-client
.
Specific Maven instructions are given for each module (below).
Modules
This library is composed of nine modules:
- google-api-client
- google-api-client-android
- google-api-client-appengine
- google-api-client-servlet
- google-api-client-gson
- google-api-client-jackson2
- google-api-client-protobuf
- google-api-client-xml
google-api-client
The Google API Client Library for Java (google-api-client) is designed to be compatible with all supported Java platforms, including Android.
Maven usage:
<dependency> <groupId>com.google.api-client</groupId> <artifactId>google-api-client</artifactId> <version>2.4.0</version> </dependency>
On Android, you will need to explicitly exclude unused dependencies:
<dependency> <groupId>com.google.api-client</groupId> <artifactId>google-api-client</artifactId> <version>2.4.0</version> <exclusions> <exclusion> <artifactId>xpp3</artifactId> <groupId>xpp3</groupId> </exclusion> <exclusion> <artifactId>httpclient</artifactId> <groupId>org.apache.httpcomponents</groupId> </exclusion> <exclusion> <artifactId>junit</artifactId> <groupId>junit</groupId> </exclusion> <exclusion> <artifactId>android</artifactId> <groupId>com.google.android</groupId> </exclusion> </exclusions> </dependency>
google-api-client-android
Extensions to the Google API Client Library for Java (google-api-client-android) support Java Google Android (only for SDK >= 2.1) applications. This module depends on google-api-client and google-http-client-android.
Maven usage:
<dependency> <groupId>com.google.api-client</groupId> <artifactId>google-api-client-android</artifactId> <version>2.4.0</version> </dependency>
google-api-client-servlet
Servlet and JDO extensions to the Google API Client Library for Java (google-api-client-servlet) support Java servlet web applications. This module depends on google-api-client and google-oauth-client-servlet.
Maven usage:
<dependency> <groupId>com.google.api-client</groupId> <artifactId>google-api-client-servlet</artifactId> <version>2.4.0</version> </dependency>
google-api-client-appengine
Google App Engine extensions to the Google API Client Library for Java (google-api-client-appengine) support Java Google App Engine applications. This module depends on google-api-client, google-api-client-servlet, google-oauth-client-appengine and google-http-client-appengine.
Maven usage:
<dependency> <groupId>com.google.api-client</groupId> <artifactId>google-api-client-appengine</artifactId> <version>2.4.0</version> </dependency>
google-api-client-gson
GSON extensions to the Google API Client Library for Java (google-api-client-gson). This module depends on google-api-client and google-http-client-gson.
Maven usage:
<dependency> <groupId>com.google.api-client</groupId> <artifactId>google-api-client-gson</artifactId> <version>2.4.0</version> </dependency>
google-api-client-jackson2
Jackson2 extensions to the Google API Client Library for Java (google-api-client-jackson2). This module depends on google-api-client and google-http-client-jackson2.
Maven usage:
<dependency> <groupId>com.google.api-client</groupId> <artifactId>google-api-client-jackson2</artifactId> <version>2.4.0</version> </dependency>
google-api-client-protobuf
Protocol buffer extensions to the Google API Client Library for Java (google-api-client-protobuf). This module depends on google-http-client-protobuf and google-api-client.
Maven usage:
<dependency> <groupId>com.google.api-client</groupId> <artifactId>google-api-client-protobuf</artifactId> <version>2.4.0</version> </dependency>
google-api-client-xml
XML extensions to the Google API Client Library for Java (google-api-client-xml). This module depends on google-api-client and google-http-client-xml.
Maven usage:
<dependency> <groupId>com.google.api-client</groupId> <artifactId>google-api-client-xml</artifactId> <version>2.4.0</version> </dependency>