Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Android™ Runtime Development

Retaining the Original Package Name for Upgrades to AIR Applications using AIR Captive Runtime

by BlackBerry Development Advisor ‎04-21-2014 10:22 AM - edited ‎04-23-2014 03:46 PM (1,360 Views)

Summary

 

This article applies to the following:

  • Adobe® AIR® Applications created for BlackBerry® 10 
  • Adobe AIR Applications using the AIR Captive Runtime for Android™ 

 

Updates to existing BlackBerry 10 applications must use the same signing key and same package name, otherwise they can be rejected by BlackBerry World or the application will appear as a second icon on their device and the updated application will not have access to the previous application's saved data. Details on that scenario can be found in the article:  Error "File bundle (your_name) has been rejected." When Uploading BAR File to BlackBerry® World™

 

By default, when you export an AIR application from Adobe® Flash Builder® that uses the AIR Captive Runtime, "air." is prefixed to the application's package name.  This does not occur when you export BlackBerry applications.  This means if your BlackBerry application specified a package name of com.mypackage.myapp, the exported BAR file would use com.mypackage.myapp as the package name, but the exported APK would use air.com.mypackage.myapp.  This default configuration will break upgrades for users of existing applications if you were to repackage that APK file as a BAR file and submit to BlackBerry World.

 

Removing the air. Prefix From Your Package Name

 

There are two sets of instructions below, one for using Adobe AIR SDK 3.8 or higher in Flash Builder and another for using an Adobe AIR SDK lower than version 3.8.  If you wish to update the Adobe AIR SDK in Flash Builder refer to this Adobe help article: Flash Builder Help - Update the AIR SDK for ActionScript Projects | Flash Builder 4.7  Note that this is not required and you can retain your existing Flash Builder development environment.

 

 

Using Flash Builder with Adobe AIR SDK 3.8 or higher

 

  1. Create an environment variable called AIR_NOANDROIDFLAIR and set its value to true.  This is case sensitive: the variable name must be all upper case and true must be lower case.
  2. Restart Flash Builder.
  3. Export a Release Build using the AIR Captive Runtime for Android.
    1. Right click on your Project in Flash Builder and click Export.
    2. Select Release Build, then click Next.
    3. Select only Google Android as the Target Platform, then click Next.
    4. Select "Export Application with Captive Runtime", then click Next.
  4. Package the exported APK file as a BAR file.
  5. Open the BAR file using an archive utility such as WinZip and verify the Package-name in the \META-INF\manifest.mf file does not contain the air. prefix.  If it does, your installation of Flash Builder is using an AIR SDK lower than 3.8.  You will need to perform the steps below.

 

Using Flash Builder with Adobe AIR SDK lower Than 3.8

 

The steps below can be used by developers who wish to continue using a version of Adobe AIR SDK lower than 3.8 in Flash Builder. You will need to download the Adobe AIR SDK version 3.8 or higher to package your application.  Compilation of your .swf files can be done using your existing SDK.

 

  1. Download the latest Adobe AIR SDK and unzip it to a new folder on your computer.
  2. Create an environment variable called AIR_NOANDROIDFLAIR and set its value to true.  This is case sensitive: the variable name must be all upper case and true must be lower case.
  3. Right click on your project in Flash Builder and click Export.
  4. Select Release Build, then click Next.
  5. Select only Google Android as the Target Platform.
  6. In the Export section, select Keep bin-release-temp folder.
  7. Click Next.
  8. Click Cancel.  This should result in a new bin-release-temp folder in your project.  It should contain your -app.xml, bar-descriptor.xml and .swf files for your application.
  9. Copy files from that folder to a new folder on your computer.
  10. Open a command prompt and navigate to the folder created in step 8.
  11. Run Command:
    java.exe -jar "PATH_YOU_UNZIPPED_AIR_SDK_FROM_STEP_1\lib\adt.jar" -package -target apk-captive-runtime -storetype pkcs12 -keystore "PATH_TO_YOUR\AndroidCert.p12" -storepass yourAndroidCertPassword YourApp.apk YourApp-app.xml YourApp.swf bar-descriptor.xml

     Update the parameters in the command above to match your paths, password, and application name.

  12. Package the exported APK file as a BAR file.
  13. Open the BAR file using an archive utility such as WinZip and verify the Package-name in the \META-INF\manifest.mf file does not contain the air. prefix.

 

Note:  Before packaging an upgrade to an existing AIR Application for submission to Google Play™ or the Apple App store, remove the AIR_NOANDROIDFLAIR environment variable or set it to false to ensure the air. prefix is present.

Contributors
Users Online
Currently online: 4 members 896 guests
Please welcome our newest community members: