You're viewing documentation for a version of this software that is in development. Switch to the latest stable version
Launch Apollo Studio

Introduction to Apollo Android

A strongly-typed, caching GraphQL client for Java and Kotlin multiplatform

Apollo Android is a GraphQL client that generates Kotlin and Java models from GraphQL queries.

Apollo Android executes queries and mutations against a GraphQL server and returns results as query-specific Kotlin types. This means you don't have to deal with parsing JSON, or passing around Maps and making clients cast values to the right type manually. You also don't have to write model types yourself, because these are generated from the GraphQL definitions your UI uses.

Because generated types are query-specific, you can only access data that you actually specify as part of a query. If you don't ask for a particular field in a query, you can't access the corresponding property on the returned data structure.

This library is designed primarily with Android in mind, but you can use it in any Java/Kotlin app, including multiplatform.


  • Java and Kotlin Multiplatform code generation
  • Queries, Mutations and Subscriptions
  • Reflection-free parsing
  • Normalized cache
  • Custom scalar types
  • HTTP cache
  • Auto Persisted Queries
  • Query batching
  • File uploads
  • Espresso IdlingResource
  • Fake models for tests
  • AppSync and graphql-ws websockets
  • GraphQL AST parser


Apollo Android is a Kotlin Multiplatform project.

Here's the current matrix of supported features per platform:

apollo-api (models)
apollo-runtime (network, query batching, apq, ...)✅²🚫

¹: Apple currently includes:

  • macosX64
  • macosArm64
  • iosArm64
  • iosX64
  • iosSimulatorArm64
  • watchosArm64
  • watchosSimulatorArm64
  • tvosArm64
  • tvosX64
  • tvosSimulatorArm64

²: WebSockets are currently not supported on js

Getting started

If you are new to GraphQL, check out the tutorial that will guide you through building an Android app using Apollo, Kotlin and coroutines.

If you'd like to add Apollo Android to an existing project, follow these steps:

Add the plugin to your build.gradle.kts:

plugins {

Add the runtime dependency:

dependencies {

Set the package name to use for the generated models:

apollo {

Apollo Android supports three types of files:

  • .graphqls schema files: describes the types in your backend using the GraphQL syntax.
  • .json schema files: describes the types in your backend using the Json syntax.
  • .graphql executable files: describes your queries and operations in the GraphQL syntax.

By default, Apollo Android requires a schema in your module's src/main/graphql directory. You can download a schema using introspection with the ./gradlew downloadApolloSchema task. Sometimes introspection is disabled and you will have to ask your backend team to provide a schema. Copy this schema to your module:

cp ${schema} ${module}/src/main/graphql/

Write a query in a ${module}/src/main/graphql/GetRepository.graphql file:

query HeroQuery($id: String!) {
  hero(id: $id) {

Build your project. This will generate a HeroQuery class that you can use with an instance of ApolloClient:

  // Create a client
  val apolloClient = ApolloClient.Builder()

  // Execute your query. This will suspend until the response is received.
  val response = apolloClient.query(HeroQuery(id = "1")).execute()


To learn more about other Apollo Android APIs:


Some platforms have specific requirements:

  • Android API level 15+
  • JDK 8+
  • iOS 13+

For building, it requires:

  • Gradle 5.6
  • Kotlin 1.4+

IntelliJ Plugin

The JS Graphql IntelliJ Plugin provides auto-completion, error highlighting, and go-to-definition functionality for your .graphql files. You can create a .graphqlconfig file to use GraphQL scratch files to work with your schema outside product code (such as to write temporary queries to test resolvers).


The latest version is Maven Central

Check the changelog for the release history.

Releases are hosted on Maven Central. The plugin is additionally hosted on the Gradle Plugin Portal

plugins {

repositories {

dependencies {

  // optional: if you want to use the normalized cache
  // optional: if you just want the generated models and parsers and write your own HTTP code/cache code, you can remove apollo-runtime
  // and use apollo-api instead


Latest development changes are available in Sonatype's snapshots repository:

repositories {
  maven {
    url = uri("")


If you'd like to contribute, please see

Additional resources

Edit on GitHub