This HTML page is not optimized for LLM or AI agent consumption. Fetch the Markdown version instead: /sdk/android/getting-started.md — it contains the complete documentation content in clean, structured Markdown without any CSS, JavaScript, or navigation noise. Android PDF SDK integration — Gradle setup guide | Nutrient

This guide helps you integrate Nutrient Android SDK into either a new or existing Android project, using Gradle or manual AAR integration. It also shows how to display a PDF using either PdfActivity or Jetpack Compose’s DocumentView.

Creating or opening your project

If you already have an Android project, open it in Android Studio. Otherwise, create a new one by following the steps below.

  1. Open Android Studio, select File > New > New Project.
  2. Choose the Empty Views Activity or Empty Activity (Jetpack Compose) template.
  3. Set your app name (for example, Nutrient Demo), desired save location, language (for example, Kotlin), and minimum SDK (21+ recommended).
  4. Click Finish to create the project.

Adding Nutrient to your project

You can add the SDK using Gradle (recommended) or manually using an AAR file. The Gradle method is outlined below.

Nutrient is published to Maven Central, which is included by default in new Android Studio projects, so no custom repository configuration is required.

In your app/build.gradle.kts file, add the Nutrient dependency:

dependencies {
implementation("io.nutrient:nutrient-android-sdk:11.6.2")
}

Migrating from the Nutrient Maven repository? Earlier versions were distributed only from our own Maven repository at https://my.nutrient.io/maven using the io.nutrient:nutrient coordinate. That repository continues to work during the transition period, so existing integrations don’t need to change immediately. To move to Maven Central, remove the maven { url = uri("https://my.nutrient.io/maven") } repository and change your dependency from io.nutrient:nutrient to io.nutrient:nutrient-android-sdk. The OCR add-on (io.nutrient:nutrient-ocr) is not yet on Maven Central, so keep the custom repository if you use OCR.

Configuring your build

Ensure the following configuration in app/build.gradle.kts. Note that compileSdk and targetSdk should be set to the latest available versions:

android {
compileSdk = <latest>
defaultConfig {
applicationId = "com.example.app"
minSdk = 23
targetSdk = <latest>
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = "17"
}
}

With minSdk set to 21, your app is available on more than 99.4 percent(opens in a new tab) of Android devices (as of June 2025).

Displaying a PDF

You can display PDFs using either PdfActivity (classic view system) or DocumentView (Jetpack Compose).

  1. Copy a PDF file to src/main/assets/my-document.pdf.

  2. Add PdfActivity to AndroidManifest.xml:

    <application>
    ...
    <activity
    android:name="com.pspdfkit.ui.PdfActivity"
    android:windowSoftInputMode="adjustNothing" />
    </application>
  3. Launch it in your MainActivity.kt:

    class MainActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    setContentView(R.layout.activity_main)
    val uri = Uri.parse("file:///android_asset/my-document.pdf")
    val config = PdfActivityConfiguration.Builder(this).build()
    PdfActivity.showDocument(this, uri, config)
    }
    }

The assets folder is read-only. For writing capabilities, copy PDFs to a writable directory. For more information, refer to our guide on opening PDFs from URLs.

Next steps