Manual library integration

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

  1. Download the Nutrient Android SDK library AAR bundle from our Maven repository.

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

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

dependencies {
	implementation(files("libs/pspdfkit-2024.9.0.aar")

	// You must include all transitive dependencies of Nutrient.
	implementation("androidx.appcompat:appcompat:1.7.0")
	implementation("androidx.cardview:cardview:1.0.0")
	implementation("androidx.compose.material:material:1.7.5")
	implementation("androidx.compose.runtime:runtime-rxjava3:1.7.5")
	implementation("androidx.compose.runtime:runtime:1.7.5")
	implementation("androidx.compose.ui:ui:1.7.5")
	implementation("androidx.constraintlayout:constraintlayout:2.2.0")
	implementation("androidx.exifinterface:exifinterface:1.3.7")
	implementation("androidx.fragment:fragment-ktx:1.8.5")
	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.1.0")
	implementation("androidx.webkit:webkit:1.12.1")
	implementation("com.getkeepsafe.relinker:relinker:1.4.5")
	implementation("com.google.android.material:material:1.12.0")
	implementation("io.reactivex.rxjava3:rxandroid:3.0.2")
	implementation("io.reactivex.rxjava3:rxjava:3.1.6")
	implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:2.0.20")
	implementation("org.jetbrains.kotlin:kotlin-stdlib:2.0.20")
	implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.7.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, Nutrient 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, look in the proguard.txt file, which is located inside the PSPDFKit .aar:

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