Manual Library Integration

PSPDFKit for Android can be imported manually. Below are the steps to follow if you wish to do so.

  1. Download the PSPDFKit for Android library AAR bundle from our Maven repository.

  2. Copy the PSPDFKit AAR file into your project’s libs directory, and rename it to pspdfkit-2024.1.1.aar.

  3. Include PSPDFKit as a file-based dependency in your project, and provide all the transitive dependencies required by PSPDFKit (as shown below):

dependencies {
	implementation files('libs/pspdfkit-2024.1.1.aar')

	// You must include all transitive dependencies of PSPDFKit.
	implementation 'androidx.appcompat:appcompat:1.6.1'
	implementation 'androidx.cardview:cardview:1.0.0'
	implementation 'androidx.compose.runtime:runtime-rxjava3:1.5.4'
	implementation 'androidx.compose.runtime:runtime:1.5.4'
	implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
	implementation 'androidx.exifinterface:exifinterface:1.3.6'
	implementation 'androidx.fragment:fragment-ktx:1.6.2'
	implementation 'androidx.gridlayout:gridlayout:1.0.0'
	implementation 'androidx.legacy:legacy-support-v4:1.0.0'
	implementation 'androidx.palette:palette:1.0.0'
	implementation 'androidx.preference:preference:1.2.1'
	implementation 'androidx.recyclerview:recyclerview:1.3.2'
	implementation 'androidx.viewpager2:viewpager2:1.0.0'
	implementation 'androidx.webkit:webkit:1.8.0'
	implementation 'com.getkeepsafe.relinker:relinker:1.4.5'
	implementation 'com.google.android.material:material:1.9.0'
	implementation 'io.reactivex.rxjava3:rxandroid:3.0.2'
	implementation 'io.reactivex.rxjava3:rxjava:3.1.6'
	implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.9.20'
	implementation 'org.jetbrains.kotlin:kotlin-stdlib:1.9.20'
	implementation 'org.jetbrains.kotlinx:kotlinx-serialization-json:1.5.1'
}

ℹ️ Note: Starting with the Android Gradle plugin 3.5.0, the use of flatDir repositories to include local AAR files is no longer supported. If you’ve been using this technique, you need to migrate to file-based dependencies when updating the Android Gradle plugin to 3.5.0.

The following library is included in the list of transitive dependencies:

  • ReLinker — to work around some versions of Android that have unreliable PackageManager implementations

This optional library can be omitted from the list of transitive dependencies if you don’t want to bundle it with your app. In such a case, PSPDFKit will detect the absence of this dependency and fall back to different implementations.

ProGuard

There’s no need to specify additional ProGuard rules since PSPDFKit uses consumersProguardFiles to keep ProGuard from obfuscating the required symbols. If you want to check out the rules, you should take a look at proguard.txt, which is located inside the PSPDFKit .aar:

cd [YOUR_AAR_LOCATION]
	unzip [YOUR_AAR_NAME].aar -d aar-contents
	cat aar-contents/proguard.txt