Adobe RMSDK and DL Reader

Building Book2png on Android

Supported tools and Software

For your Mac computer we recommend the Mac OS 10.9.5 as the minimum operating system version.

We assume that you will have Eclipse installed on your system.

Android tools
  1. Google Android Development Tools (ADT) Bundle development environment for Mac OSX.  Scroll down to “Download the ADT Plugin” for the repository to access the file you need.  Scroll to “Troubleshooting the ADT Installation” if necessary.
  2. Android NDK r9d and GCC 4.8 for the DL Reader JNI. NDK r9d for Mac is available here.
  3. Android 2.2, API level 8 SDK (via Android SDK Manager)
Xcode: 6.1.1 Integrated Development Environment (IDE)

Check to see if the Xcode tool is already installed on your Mac. In the Applications folder open Utilities and Terminal, and type:
xcode-select –p
You should see the developer folder returned:

Xcode1

You can also go to Xcode:Preferences:Locations to see the command line tool option listed.

To install the Xcode command line tool, run
xcode-select --install
Xcode2

Environment Settings

Set the following environment values either in the active build environment, using the Terminal on Mac, for example, or through your profile.

In the Applications folder open Utilities and Terminal, and enter a series of export commands to define the Android NDK and SDK home, the NDK root, and Apache Ant home.

In these examples we offer the folder “devtool” as an example. You can substitute your own folder name:

export ANDROID_SDK_HOME=/devtool/ANDROID/opt/android-sdk-macosx
export ANDROID_NDK_HOME=/devtool/ANDROID/android-ndk-r9d-x86_64
export ANDROID_NDK_ROOT=/devtool/ANDROID/android-ndk-r9d-x86_64
export ANT_HOME=/devtool/Documents/apache-ant-1.9.3

Installing RMSDK

Download the RMSDK 11 installation package, a file called Adobe_RMSDK_Object_11.0.2_2015_05_20.zip. Create a working directory for the software product and unzip the file to that working directory, such as /project/RMSDK11.

Note: DL Reader uses a different version of OpenSSL from Book2png, openssl-1.0.1j.tar.gz.xt.

Download the OpenSSL and cURL files.

Unzip Curl-7.36.0.zip and openssl-1.0.1g.tar.gz to their respective /thirdparty/ folders under the RMSDK root directory.

Unzip Curl-7.36.0.zip to:
RMSDK root/thirdparty/curl
Unzip openssl-1.0.1g.tar.gz to:
RMSDK root/thirdparty/openssl

Set Environment Variables

Change to the root directory you created for RMSDK when you installed the product, and to the directory /build/sdk.

If .profile is set up, enter this command:
ant setup.env.vars
If you do not wish to modify your .profile, supply values that reflect your environment. Enter commands to set the environment variables for SDK, NDT, and Ant, as shown below. As before, the path names shown below are sample directory structures. You can substitute your own folder names:

ant setup.env.vars
-DANDROID_SDK_HOME="/devtool/ANDROID/opt/android-sdk-macosx"
-DANDROID_NDK_HOME="/devtool/ANDROID/android-ndk-r9d-x86_64"
-DANT_HOME="/Development/apache-ant-1.9.4"

Then run:
ant book2pngandroid.objonly
This will create the following unsigned APK files:
RMSDK root/samples/book2png/build/android/bin/book2png-android-arm.apk
RMSDK root/samples/book2png/build/android/bin/book2png-android-x86.apk

Note:The Book2png viewer is not designed to work in Eclipse for RMSDK11. So the files in the RMSDK samples directory for Book2png (/samples/book2png) will not import in to Eclipse.

Signing Your App Manually

You do not need Android Studio to sign your app. You can sign your app from the command line using standard tools from the Android SDK and the JDK. To sign an app in release mode from the command line, start by generating a private key using Keytool.

Java Keytool is a key and certificate management utility.

In this example, we use the genkey command:
$ keytool -genkey -v -keystore my-release-key.keystore
-alias alias_name -keyalg RSA -keysize 2048 -validity 10000

Keytool prompts you for passwords for the keystore and key, and to provide the Distinguished Name fields for your key. It then generates the keystore as a file called my-release-key.keystore. The keystore contains a single key, valid for 10,000 days. The alias is a name that you will use later when signing your app.

Compile your app in release mode to obtain an unsigned APK.

Sign your app with your private key using Jarsigner. Jarsigner is a Java tool that generates signatures for Java archive (JAR) files, and verifies the signatures of signed JAR files. Use this command:
$ jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1
-keystore my-release-key.keystore my_application.apk alias_name

With this example you will be prompted for the passwords for the keystore and key. It then updates the APK file in-place to sign it. Note that you can sign an APK multiple times with different keys.

Verify that your APK is signed. For example:
$ jarsigner -verify -verbose -certs my_application.apk
Align the final APK package using Zipalign:
zipalign -v 4 your_project_name-unaligned.apk your_project_name.apk
Zipalign is an Android archive alignment tool that optimizes Android application (apk) files. It is included with the Android SDK. It works to help the Android operating system interact with the app more efficiently.

Zipalign ensures that all uncompressed data starts with a particular byte alignment relative to the start of the file, which reduces the amount of memory consumed by an app.