> For the complete documentation index, see [llms.txt](https://docs.apryse.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.apryse.com/android/get-started/get-started/cordova.md).

# Integrate Android PDF Library into Cordova

Learn how to integrate the Apryse Cordova Native Plugin for Android applications using Cordova. Follow step-by-step instructions and get a free trial with unlimited usage and support. Check out this g

## This project is no longer in development. If you are looking for cross-platform solution, check out [React Native](https://github.com/ApryseSDK/pdftron-react-native/) or [Flutter](https://github.com/ApryseSDK/pdftron-flutter/). If you are looking to add to your current Cordova/Ionic project, check out the [WebViewer sample](https://github.com/ApryseSDK/webviewer-cordova-sample/).

{% hint style="info" %}
**See here for the get started guide for using the Apryse Cordova Native Plugin on iOS.**
{% endhint %}

This guide will help you integrate a free trial of the Apryse Native Plugin for Android applications using Cordova. Your free trial includes unlimited trial usage and support from solution engineers.

**Note:** There are other approaches that can be used to integrate Apryse technology with Cordova. Please see [this FAQ page](/ios/guides/cordova/pdftron-ionic-cordova-options.md) to find out more about the relative strengths of each approach.

<a href="https://github.com/ApryseSDK/pdftron-cordova/" class="button primary">Get the Apryse Cordova source code</a>

## Prerequisites

* [Node.js](https://nodejs.org/en/) and [npm](https://www.npmjs.com/get-npm/)
* [Cordova CLI](https://cordova.apache.org/docs/en/latest/guide/cli/#installing-the-cordova-cli)
* [Android Studio](https://developer.android.com/studio/) (The Eclipse IDE is not supported)

{% hint style="info" %}
**No trial license key required.**

The trial of Apryse Mobile SDK does not require a trial key. A commercial license key is required for use in a production environment. Please [contact sales](https://apryse.com/form/contact-sales) to purchase a commercial key or if you need any other license key assistance.
{% endhint %}

{% hint style="warning" %}
**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).
{% endhint %}

## Setup

If you don't already have a Cordova codebase, start one. If you do, then make sure Android is added as a platform and skip to integration.

1. Create a new Cordova project called `pdfhello`

{% tabs %}
{% tab title="Shell" %}
{% code lineNumbers="true" %}

```sh
cordova create pdfhello com.example.pdf pdfhello

 cd pdfhello
```

{% endcode %}
{% endtab %}
{% endtabs %}

1. Add Android as a platform to build the Cordova application for.

{% tabs %}
{% tab title="Shell" %}
{% code lineNumbers="true" %}

```sh
cordova platform add android
```

{% endcode %}
{% endtab %}
{% endtabs %}

## Integrate Apryse Native Plugin into your Cordova Application

1. Add the `pdftron-cordova` plugin in your project directory.

{% tabs %}
{% tab title="Shell" %}
{% code lineNumbers="true" %}

```sh
cordova plugin add https://github.com:PDFTron/pdftron-cordova.git
```

{% endcode %}
{% endtab %}
{% endtabs %}

1. Navigate to `pdfhello/platforms/android` and add the following line in the `gradle.properties file`:Key can be left empty for a trial

{% tabs %}
{% tab title="Shell" %}
{% code lineNumbers="true" %}

```sh
android.useAndroidX=true
 android.enableJetifier=true
 PDFTRON_LICENSE_KEY=INSERT_COMMERCIAL_LICENSE_KEY_HERE_AFTER_PURCHASE
```

{% endcode %}
{% endtab %}
{% endtabs %}

1. Navigate to `pdfhello/platforms/android/app/main/` and open `AndroidManifest.xml` with your favorite text editor.Change the activity theme to `CustomAppTheme`:

{% tabs %}
{% tab title="XML" %}
{% code lineNumbers="true" %}

```xml
-<activity android:name="MainActivity" android:theme="@android:style/Theme.DeviceDefault.NoActionBar">
+<activity android:name="MainActivity" android:theme="@style/CustomAppTheme">
```

{% endcode %}
{% endtab %}
{% endtabs %}

1. Navigate to `pdfhello/platforms/android/app/main/com/example/pdf/` and open `MainActivity.java` with your favorite text editor. Change the base class for the main activity from `CordovaActivity` to `CordovaAppCompatActivity`:

{% tabs %}
{% tab title="Java" %}
{% code lineNumbers="true" %}

```java
-public class MainActivity extends CordovaActivity {
+public class MainActivity extends CordovaAppCompatActivity {
```

{% endcode %}
{% endtab %}
{% endtabs %}

1. After the changes, you will need to call the following to build and run the project:First, in `pdfhello` directory call:Then import the `pdfhello/platforms/android` folder into **Android Studio**, and run the project from Android Studio using the play button. **You will see a message that says `No Java files found that extend CordovaActivity`. This message is okay to ignore because we're using CordovaAppCompatActivity.Note:** When the project is first imported, Android Studio will complain about the minSdk. To resolve this, click `Move minSdkVersion to build files and sync project` in the error window.

{% tabs %}
{% tab title="Bash" %}
{% code lineNumbers="true" %}

```bash
cordova build android
```

{% endcode %}
{% endtab %}
{% endtabs %}

## Next step

<a href="/android/get-started/get-started/cordova/view-a-document.md" class="button primary">View a document</a>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.apryse.com/android/get-started/get-started/cordova.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
