Attention Android Developers, learn how to convert your APK to a BlackBery 10 app in a few minutes

With the arrival of the new Android Runtime for BlackBerry 10, supporting Jelly Bean 4.2.2, now you can convert pretty much any Android app to a BlackBerry 10 app.

Recently, new tools were also released to help you on that process, they are called BlackBerry Tools for Android Development 2.0 Beta (see details).

Two of the main updates are:

  • No need to download the entire (and heavy) Android SDK
  • Now the command-line tools have a Graphical User Interface (GUI) to guide the developer throughout the conversion process

In this tutorial, you will see all the necessary steps to convert your APK to a BAR (BlackBerry Archive) in order to have you app available in the BlackBerry World application store.

Let’s get started?

Step 1: Click here to download the Command-line tools for Android Apps 2.0.1 Beta (3.3MB)

Step 2: Extract the .zip contents to your computer
Extract the .zip content to any folder in your computer.

Step 2.5: Make sure you have an ID token to sign BlackBerry 10 apps. You need to sign your app if you plan to submit it to BlackBerry World. If you don’t have your ID token already, please follow the two steps below, otherwise just jump to Step 4.

  • Request your BlackBerry ID token here. Choose the first option (“For BlackBerry 10…”) and you will be redirected to the BlackBerry ID login page (create one BlackBerry ID if you don’t have one, you will need to confirm via email, then click back on the link above to login). After logging in with your BlackBerry ID, the next step is to choose a password (keystore) for your BlackBerry ID token (recommendation: choose a simple password such as 87654321 to avoid forgetting it). Then your bbidtoken.csk will be generated and downloaded to your computer. Save the file in the following folder (create the folder if you don’t have one):
    * Windows XP: %HOMEPATH%\Local Settings\Application Data\Research In Motion
    * Windows Vista, Windows 7, and Windows 8: %HOMEPATH%\AppData\Local\Research In Motion
    * Mac OS: ~/Library/Research In Motion
  • After having your bbidtoken.csk in the right folder, you will also have to generate an author.p12 file, which will show up beside your bbidtoken.csk file. In order to create your author.p12, from Finder (Mac) or Windows Explorer (Windows), navigate to the folder extracted on Step 2 and find the /bin folder. In there, you will find a guy called blackberry-keytool. With your Terminal (Mac) or Prompt (Windows) opened, drag that guy and release it on top of your terminal window. Then type -genkeypair -storepass -dname “cn=Your Name”.
    The instruction will look like this: “extracted folder path”/bin/blackberry-keytool -genkeypair -storepass -dname “cn=Your Name”
    Press ENTER to run the command and your author.p12 file will show up beside your bbidtoken.csk in the right folder. That’s it! Now you can sign BlackBerry 10 apps and submit them to BlackBerry World. Let’s get back to the porting steps, you can jump to Step 4.

Step 3: Open Terminal on a Mac or Command Prompt on Windows
Mac: click to the magnifying glass (top right on your screen) and type Terminal
Windows: click on START, then RUN then type cmd
Hit ENTER.

Step 4: Open the APK Packager GUI
On Finder (Mac) or Windows Explorer (Windows), navigate to the extracted folder on Step 2 and find the /bin folder. In there, you will find a guy called blackberry-apkpackager. With your Terminal (Mac) or Prompt (Windows) opened, drag that guy and release it on top of your terminal window, then type -gui. It means you will execute the command blackberry-apkpackager passing the instruction -gui to open its GUI (Graphical User Interface, or visual assistant).
The instruction will look like this: “extracted folder path”/bin/blackberry-apkpackager -gui
Hit ENTER and this window will open:

Step 5: Convert your APK
With your GUI opened, select your APK, check the option DEPLOY and then click on the PACKAGE button.

If you don’t want to sign your application, but test it on a BlackBerry 10 device, you will need a Debug Token. To create one and send it to your device, with your GUI opened, click on ADVANCED SETTINGS and with DEVELOPMENT MODE checked, click on the button beside the Author field. Then, with your device connected via USB, click on DEPLOY DEBUG TOKEN.

Step 6: Testing your new app on your BlackBerry 10 device
As soon as the packaging process finishes, the BlackBerry Deploy window shows up:

Check if your device is with DEVELOPMENT MODE on (SETTINGS>SECURITY AND PRIVACY>DEVELOPMENT MODE).
If you’re connected via USB, remember that the device IP will be 169.254.0.1, if it’s over Wifi, type the network IP. Type your device password and click on INSTALL.

That’s it! Now you can test your .bar (BlackBerry 10 app) converted from an .apk (Android App) on your device.

If you decide to submit your .bar to BlackBerry World, remember to repeat Step 5, now checking the option SIGN.

Then create your vendor account on https://appworld.blackberry.com/isvportal, submit your docs and as soon as you’re approved, you will be able to submit your signed .bar and publish your app to the entire community of BlackBerry 10 users all over the world.

If you are an old BlackBerry developer used to keep (and do backups) of your signing keys (barsigner.csk…), that process has changed (as you saw above). Now everything is done with your bbidtoken.csk, which can be downloaded to any computer every time you need to sign apps (just repeat Step 2.5 to get there).

But what happens if I’m an older developer, always did backups of my keys and have apps already on BlackBerry World?
Great question! And the solution is very simple, you just need to link your new bbidtoken with your old barsigner.csk, once.

Having problems converting your APK?
In a few cases, APKs can have execution problems, because they use some native core Android services. In the case of maps, the MapView v2 won’t work, and the solution is: 1) use MapView v1, or 2) replace your map with a WebView and use Google Maps with HTML5.

Good luck and happy porting!

Wow. It's Quiet Here...

Be the first to start the conversation!

Leave a Reply:

Gravatar Image