This repository demonstrates how to integrate GraphQL into an Android application using Kotlin and the Apollo GraphQL client. The example app fetches country names from a GraphQL API and displays them in a RecyclerView.
For a detailed guide on integrating GraphQL into Android using Apollo, check out the Medium article.
- GraphQL Integration: Fetch only the data you need with GraphQL.
- Apollo Client: Efficiently handles GraphQL queries and responses.
- Dependency Injection: Configured with Dagger Hilt.
- Modern UI: Simple and responsive interface using RecyclerView.
Update your build.gradle.kts
(app level):
plugins {
id("com.apollographql.apollo") version "version.number"
id("kotlin-kapt")
id("com.google.dagger.hilt.android")
}
dependencies {
implementation("com.apollographql.apollo:apollo-runtime:version.number")
implementation("com.squareup.okhttp3:okhttp:version.number")
implementation("com.squareup.okhttp3:logging-interceptor:version.number")
implementation("com.google.dagger:hilt-android:version.number")
kapt("com.google.dagger:hilt-compiler:version.number")
implementation("androidx.fragment:fragment-ktx:version.number")
}