Creating an obfuscated APK file from MobileFirst Studio

To create an obfuscated application package (.apk) file in IBM MobileFirst™ Platform Studio, you edit the Android native project properties file, then build your application in release mode.

Before you begin

About this task

The following steps assume that you are developing in an Eclipse integrated development environment (IDE).

Procedure

  1. Complete the appropriate steps in the following table, depending on whether you are developing a native or a hybrid application:
    Native Android application Hybrid Android application
    1. Copy the file proguard-project.txt from the MobileFirst Native API for Android application to your Android project in Eclipse.
    2. Open the project.properties file with a text editor and add the text proguard.config=proguard-project.txt on a separate line in the file.
    1. Open the project_name/apps/app_name/android/native/project.properties file with a text editor.
    2. In the project.properties file that you just opened, uncomment the line proguard.config=proguard-project.txt.
  2. Add any other configuration details that might be needed by your application to the proguard-project.txt file.
  3. Build your application in release mode.
  4. Save a copy of the mapping.txt file. The mapping.txt file defines how your classes are obfuscated and is needed to debug stack traces.
    Important: For each build that you publish, copy the mapping.txt file or save it under a new name because subsequent builds will overwrite the file. It is important to save this file for each build for which you might need to restore a stack trace.