Some test text!

Search
Hamburger Icon

Android / Guides / 1. Integrate

Get started integrating Apryse Android SDK

Welcome to Apryse. This guide will help you integrate a free trial of Apryse Android SDK into your Android Studio projects. You can either integrate Apryse packages automatically using Gradle, or install them manually using .aar files by downloading the SDK. Pick whichever your option you prefer, but integrating with Gradle is the recommended approach. Your free trial includes unlimited trial usage and support from solution engineers.

Gradle Integration

Prerequisites

  • Android Studio

  • Project specifications:

    • Minimum API: 16 (using AndroidX)
    • Compile API: 33
    • Recommended target API: 33
    • If your app is using AndroidX you will also need to add android.useAndroidX=true and android.enableJetifier=true in your gradle.properties file. You can learn more about this here .
No trial license key required.
The trial of Apryse SDK does not require a trial key. A commercial license key is required for use in a production environment. Please fill out our contact form if you do not have a valid license key.
Keep your license keys confidential.
License keys are uniquely generated. Please make sure that it is not publicly available (e.g. in your public GitHub).

Setup

Create a new project on Android Studio called myApp.

For the purposes of this guide, you can start with an Empty Activity.

Integrate Apryse SDK into your Android application

  1. Open the settings.gradle file located in your project's root directory and add the Apryse Maven repository:

    dependencyResolutionManagement {
        repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
        repositories {
            google()
            mavenCentral()
            maven {
                url "https://pdftron-maven.s3.amazonaws.com/release"
            }
            jcenter() // Warning: this repository is going to shut down soon
        }
    }
    Apryse SDK for Android is hosted on a private Maven repository in Amazon S3, so an access token is required to download it. The project only communicates with Amazon S3 in order to download Apryse SDK for Android. Otherwise, no other communication between your environment and Amazon S3 (or any other external service) is required. If you prefer not to use Amazon S3, you can find an alternative approach here .
  2. Open the build.gradle file in your app module's directory:

    Edit it to add a dependency for the full version of Apryse:

    android {
        defaultConfig {
            // ... Anything that was already here
            multiDexEnabled true
            vectorDrawables.useSupportLibrary = true
            manifestPlaceholders = [pdftronLicenseKey:PDFTRON_LICENSE_KEY]
        }
    }
    
    dependencies {
        // ... Anything that was already here
        implementation "com.pdftron:pdftron:10.9.0"
        implementation "com.pdftron:tools:10.9.0"
    
        implementation 'androidx.multidex:multidex:2.0.1'
    }
    The next part of this guide will use DocumentActivity to open and view a document which requires the full version of Apryse SDK. The standard version has lighter set of features to reduce the size of the APK.You can find out more about the differences between the two versions here . If you would like to use the standard version instead, please take a look at this guide
  3. In your project's root directory, find the gradle.properties file. Copy the following line to it:

    # Add the PDFTRON_LICENSE_KEY variable here. 
    # For trial purposes leave it blank.
    # For production add a valid commercial license key.
    PDFTRON_LICENSE_KEY=
  4. Open your AndroidManifest.xml file and add a <metadata> tag inside the <application> tag to be a placeholder for the license key:

    <application>
    <!-- Add license key in meta-data tag here. This should be inside the application tag. -->
        <meta-data
            android:name="pdftron_license_key"
            android:value="${pdftronLicenseKey}"/>
    </application>

Next step

View a document

Have questions? Connect with our experts on Discord.