PSPDFKit 2.8 Migration Guide

This guide covers migrating to PSPDFKit 2.8 for React Native, which requires changes to move to Gradle 8.

Initializing the PSPDFKit Plugin


Customers who are using their application in production and have already set their license keys aren’t affected by this change.

PSPDFKit for React Native 2.8 now requires you to initialize the PSPDFKit plugin, even when running in trial mode. The plugin is initialized by calling either the setLicenseKey or setLicenseKeys API when your application starts. In your main .ts or .js file, add the following above your class declaration:

import { NativeModules } from 'react-native';
const PSPDFKit = NativeModules.PSPDFKit;

iOS CocoaPods Dependencies

PSPDFKit now specifies the iOS versions of the PSPDFKit and Instant SDKs as part of the plugin source code, and it no longer needs to be set in your application Podfile.

If present, remove the PSPDFKit and Instant entries from ios/Podfile:

-  pod "PSPDFKit", podspec: ""
-  pod "Instant", podspec: ""

Next, delete Podfile.lock and run pod install from within your project’s ios directory:

pod install

Bumping the Android compileSdkVersion

To continue to bring our customers the latest features offered by our native SDKs, we depend on the latest PSPDFKit Android SDK. When you upgrade to PSPDFKit 2.8 for React Native, your application’s compileSdkVersion needs to be set to a minimum of 34.

To change the compileSdkVersion of 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 34

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. Refer to our example Catalog for more details.

Upgrade Gradle

The PSPDFKit Android SDK, on which the React Native plugin depends, requires your Gradle version to be upgraded to 8. Even though the newly released React Native 0.73 also requires Gradle 8, some React Native dependencies aren’t yet supported. Check the various dependency home pages to ensure you’re running a version that supports Gradle 8. To upgrade, make the changes outlined below.

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

dependencies {

Then, update your_project_folder/android/gradle/wrapper/

- distributionUrl=https\://
+ distributionUrl=https\://

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

After upgrading to Gradle 8, you’ll be required to update your JDK version to Java 17, which is supported by Gradle 8. After downloading and installing the Java 17 JDK, ensure your JAVA_HOME environment variable in your ~/.zshrc or ~/.bash_profile is configured to point to the new JDK location.