The BlackBerry Runtime for Android apps provides a great opportunity for Android developers to expand their install base and support a new ecosystem, with minimal effort or resources. With the recent BlackBerry 10.3.1 software update, Android developers can now target Android 4.3 (API 18/Jelly Bean MR2) in addition to newly supported APIs for NFC, BTLE and BlackBerry Classic track-pad support. When targeting a new mobile ecosystem, or when working with different versions of an app, sometimes release management can prove to be troublesome.
The easiest way to troubleshoot deployment issues for Android apps on BlackBerry 10 is by using the BlackBerry Deploy tool, which is included in the BlackBerry command-line tools for Android apps. All that’s required to setup the SDK on your development machine is to download the archive here from our Android microsite, and extract it to a directory of your choice.
BlackBerry Command-line tools for Android apps
BlackBerry Tools for Android Development SDK
This same SDK also allows you to take advantage of a GUI, or use command-line arguments, to:
- Run/debug your app on BlackBerry 10 devices/simulators within your existing IDE of choice, through the BlackBerry ADB Proxy Manager
- Repackage your existing APK file into the BAR format in seconds, by using the BlackBerry APK Package
- Deploy a debug token for debugging your app on a BlackBerry 10 device, via the BlackBerry Debug Token Request tool
- Deploy (install) a BAR file to a BlackBerry 10 device, by way of the BlackBerry Deploy Tool
- Sign a BAR file with your BlackBerry ID account, with the BlackBerry Signer
With respect to the BlackBerry Deploy tool, after opening it from our SDK directory, we have the ability to input the IP address and password of the device we’re installing the specified BAR file on. If you’re deploying the BAR file over USB, the IP address should be 169.254.0.1 as shown below.
BlackBerry Deploy GUI tool after a successful deployment
However, sometimes an application is unable to be installed. When this happens, the BlackBerry Deploy tool outputs a failure message with an integer error code, which represents a corresponding value and description for the reason of failure. The negative value is a flag that the application which threw the error is an Android app, rather than an app developed natively for BlackBerry 10 using the Cascades or WebWorks SDKs. In order to understand the error code integer we receive, we can cross-reference the AOSP source code here. In particular, the PackageManager.java Class gives us the pertinent info of the error code thrown by our Dalvik instance.
Some of the more common instances of a deployment failure are described below.
|-4||INSTALL_FAILED_INSUFFICIENT_STORAGE||The device didn’t have enough storage space to install the app.|
|-12||INSTALL_FAILED_OLDER_SDK||The current SDK version is older than that required by the package.|
|-25||INSTALL_FAILED_VERSION_DOWNGRADE||The new package has an older version code than the currently installed package.|
|-102||INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION||The parser encountered an unexpected exception.|
|-103||INSTALL_PARSE_FAILED_NO_CERTIFICATES||The parser did not find any certificates in the .apk.|
|-104||INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES||If the parser found inconsistent certificates on the files in the .apk.|
Some best practices to help improve the release management portion of your development experience are:
- Store your certificates safely, and back them up, to avoid a situation where you’re unable to upgrade an application.
- Be diligent with passwords and identities when using multiple certificates across different projects.
- Use debug and release builds appropriately.
- You can always restore your BlackBerry 10 signing keys by logging into your BlackBerry ID account and downloading your signing token here.
- Android apps on BlackBerry 10 are required to have the APK file release signed for Android, and the resultant BAR file signed with BlackBerry signature keys (available here) for deployment.
- Always sign your APK and BAR files with the same certificates, and maintain the same package name to allow for application upgrades through BlackBerry World.