Skip to content

Integrate the SDK

This guide explains how to integrate Foxit PDF SDK into an Android project using AARs and complete license initialization.

Step 1: Create an Android Project

  1. Open Android Studio and choose File → New → New Project….
  2. Select the Empty Activity template and click Next.
  3. Enter your app details and create the project (for example, name it PDFReader).

Step 2: Integrate Foxit PDF SDK

This section uses direct AAR integration (recommended for quick validation). To enable the built-in reader UI via AAR, see Enable UI Extensions. For deep UI customization, import the UI Extensions source project (libs/uiextensions_src); see Customize UI via Source.

2.1 Copy AARs into the Project

Copy the following files from the SDK package libs/ into your project app/libs/:

  • Required (core)

    • FoxitRDK.aar
  • Optional (built-in UI / enable as needed)

    • UI Extensions: FoxitRDKUIExtensions.aar
    • RMS: RMSSDK-4.2-release.aar, rms-sdk-ui.aar
    • Scanning: FoxitMobileScanningRDK.aar, FoxitPDFScan-UI.aar

2.2 Configure app/build.gradle

  1. Declare libs as a local repository (to load AARs):
kotlin
repositories {
    flatDir {
        dirs 'libs'
    }
}
  1. Enable MultiDex (typically required for the SDK):
kotlin
android {
    defaultConfig {
        multiDexEnabled true
    }
}

dependencies {
    implementation 'androidx.multidex:multidex:2.0.1'
}
  1. Add SDK dependencies (minimum runnable set):
kotlin
dependencies {
    // Required: third-party dependencies (add explicitly if not already in the project)
    implementation 'androidx.appcompat:appcompat:1.3.0'
    implementation 'com.google.android.material:material:1.3.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.0.4'

    // Required: Core SDK
    implementation(name: 'FoxitRDK', ext: 'aar')
}

2.2.1 Enable UI Extensions (Full Reader)

To build a full-featured PDF reader with UI Extensions, ensure:

  • FoxitRDKUIExtensions.aar is copied to app/libs/ (see Copy AARs into the Project).
  • Add the following under dependencies in app/build.gradle:
kotlin
implementation(name: 'FoxitRDKUIExtensions', ext: 'aar')

To customize UI at source level instead of using the AAR, import libs/uiextensions_src; see Customize UI via Source.

2.3 (Optional) Dependencies for Common Extensions

Add dependencies only for features you need to avoid unnecessary bloat:

  • RMS (open RMS-protected documents)
kotlin
dependencies {
    implementation 'com.microsoft.identity.client:msal:2.+'
    implementation(name: 'RMSSDK-4.2-release', ext: 'aar')
    implementation(name: 'rms-sdk-ui', ext: 'aar')
}

Also add the Microsoft Maven repository in the project-level build.gradle, for example:

kotlin
allprojects {
    repositories {
        google()
        jcenter()
        maven {
            url 'https://pkgs.dev.azure.com/MicrosoftDeviceSDK/DuoSDK-Public/_packaging/Duo-SDK-Feed/maven/v1'
        }
    }
}
  • Screenshot
kotlin
dependencies {
    implementation 'com.edmodo:cropper:1.0.1'
}
  • Ink recognition
kotlin
dependencies {
    implementation 'com.google.mlkit:digital-ink-recognition:18.1.0'
}
  • Scanning (scanning UI module)
kotlin
dependencies {
    implementation(name: 'FoxitMobileScanningRDK', ext: 'aar')
    implementation(name: 'FoxitPDFScan-UI', ext: 'aar')
    implementation 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
}

For how to launch the scanning UI, see Integrate Scanning.

  • PDF compare
kotlin
dependencies {
    implementation "io.reactivex.rxjava2:rxjava:2.2.16"
    implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
}
  • PDF signature
kotlin
dependencies {
    implementation 'org.bouncycastle:bcpkix-jdk15on:1.64'
    implementation 'org.bouncycastle:bcprov-jdk15on:1.64'
}

2.4 Reference: app/build.gradle

The following is a complete app/build.gradle example with several optional feature dependencies for quick validation and comparison. Trim dependencies in production as needed.

[app/build.gradle]
kotlin
plugins {
    id 'com.android.application'
}

android {
    compileSdkVersion 33

    defaultConfig {
        applicationId "com.foxit.pdfreader"
        minSdkVersion 19
        targetSdkVersion 33
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        multiDexEnabled true

    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

repositories {
    flatDir {
        dirs 'libs'
    }
}

dependencies {
    implementation 'androidx.multidex:multidex:2.0.1'
    implementation 'androidx.appcompat:appcompat:1.3.0'
    implementation 'com.google.android.material:material:1.3.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
    implementation(name: 'FoxitRDK', ext: 'aar')
    implementation(name: 'FoxitRDKUIExtensions', ext: 'aar')
    implementation 'com.edmodo:cropper:1.0.1'
    // RMS
    implementation 'com.microsoft.identity.client:msal:2.+'
    implementation(name: 'RMSSDK-4.2-release', ext: 'aar')
    implementation(name: 'rms-sdk-ui', ext: 'aar')

    // Ink Recognition
    implementation 'com.google.mlkit:digital-ink-recognition:18.1.0'

    // Scanning
    implementation(name: 'FoxitPDFScan-UI', ext: 'aar')
    implementation(name: 'FoxitMobileScanningRDK', ext: 'aar')
    implementation 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
    // RxJava: Compare
    implementation "io.reactivex.rxjava2:rxjava:2.2.16"
    implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
    // Signature
    implementation 'org.bouncycastle:bcpkix-jdk15on:1.64'
    implementation 'org.bouncycastle:bcprov-jdk15on:1.64'
}

Step 3: License and Initialize the SDK

Before calling any Foxit API, complete license initialization. See Trial and Licensing.