PSPDFKit 2.2 migration guide

This guide covers migrating to version 2.2 of PSPDFKit for React Native. It outlines how to compile the SDK version upgrade and how to upgrade Gradle.

Compiling the SDK version upgrade

PSPDFKit 2.2 for React Native on Android requires a minimum compileSdkVersion of 31. When you upgrade to PSPDFKit 2.2, your Android build might fail if your android module’s compileSdkVersion is below 31.

To change compileSdkVersion for your Android module, open your module’s app-level Gradle file in your_project_folder/android/app/build.gradle, and set compileSdkVersion as shown below:

android {
    ...
    compileSdkVersion 31
    ...
}
Information

Some projects may be using Gradle extra properties (ext) to store the version number in a separate .gradle file. In this case, update the value of the `compileSdkVersion` property. See our example Catalog for more detail.

It’s recommended that you upgrade your version of Gradle, but this is optional. To upgrade, make the following changes:

In your_project_folder/android/build.gradle, change your Gradle version to 7.1.1:

dependencies {
  classpath('com.android.tools.build:gradle:7.1.1')
}

Then, update your_project_folder/android/gradle/wrapper/gradle-wrapper.properties:

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
- distributionUrl=https\://services.gradle.org/distributions/gradle-7.1.1-all.zip
+ distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrappe

Alternatively, you can open the android module of your project in the current stable Android Studio version 2021.1.1, and Android Studio will suggest an automatic Gradle update using AGP Upgrade Assistant.