1. froggy500's Avatar
    Configuring Android Apps
    11/16/2011

    Preamble
    ========
    There is plenty of documentation all over the web with how to do individual steps
    outlined below, replete with screen shots. However, it is not all in one place
    and is incomplete or outright wrong in spots. This is an attempt to clean that
    up and document everything in one place.

    Note that this applies to the BlackBerry Tablet OS 2.0 beta, and things will
    change. I used a PC running Windows XP SP3. You may have to change this to
    work in your environment.

    Background
    ==========
    1. In late Oct, 2011, Blackberry released a beta version of an OS which supports
    Android apps on the playbook. This OS is called Blackberry Tablet OS 2.0.
    Note that Blackberry cell phones have traditionally hosted a different OS
    called Blackberry OS. So Blackberry has had two separate OS's - one for cell
    phones and a different one for tablets. The only tablet currently manufactured
    is the Playbook. Plans (as reputed on the internet) is that Blackberry Tablet
    OS 2.0 will be called BBX in the future and will support the entire product
    line - tablets and cell phones.
    2. Android apps all have an extension of .apk (Application Package File). You
    cannot directly access apk files. Instead, they must be downloaded directly
    onto an Android device from the Android Marketplace (https://market.android.com/).
    (There are secondary sources of .apk apps such as Top Android Apps and Games in the Android Market | AppBrain.com, but these
    turn out to just be front-ends for the Marketplace app and you still have to
    download through there.)
    3. Blackberry Tablet (PlayBook) apps all have an extension of .bar (Blackberry
    Tablet Application). You cannot directly access bar files. Instead, they must
    be downloaded directly onto a device running a Blackberry Tablet OS. They are
    downloaded from Blackberry App World (appworld.blackberry.com).
    4. There are ways around (2) and (3), some quite awkward.
    5. To run an apk file on BBOS 2.0, you must first pre-process it and convert it
    to a bar file.
    6. Vocabulary you should know:
    - adb - Android Debug Bridge
    - avd - Android Virtual Device (simulator)
    - jdk - Java Development Kit - not to be confused with Java Runtime
    7. There is good documentation available on the android tools. See:
    emulator:
    - Using the Android Emulator | Android Developers
    adb:
    - Android Debug Bridge | Android Developers
    8. There is good documentation available on the BlackBerry Android toolkit.
    See:
    - https://bdsc.webapps.blackberry.com/.../documentation

    Resources
    =========
    You should have the following resources available in order to perform at least
    some of the steps outlined below:

    1. Google Gmail Account (required for Android emulation and Android Marketplace
    access.)
    - http://mail.google.com
    2. DropBox Account (not absolutely required, but the method I use to transfer
    files between Android and the PC.)
    - Dropbox - Simplify your life
    3. Blackberry Signing Keys (required for creating BAR files)
    - https://www.blackberry.com/SignedKeys/
    (Warning: read the RIM license agreement carefully. You may not want to do this.)

    Software Download
    =================
    In the steps which follow, you are going to have to install numerous software
    packages on your machine. Download the following packages:

    1. Blackberry Desktop:
    - BlackBerry - BlackBerry Desktop Software
    Follow instructions on page
    2. DDPb Installer:
    - DDPB Installer1.0.7.msi
    3. Java JDK:
    - Java SE Downloads
    Download Java SE; Java Platform Standard Edition
    (You may have to scroll down to see download button.)
    4. Android SDK:
    - Android SDK | Android Developers
    download installer_r15-windows.exe (or later.)
    This is basically just a download manager. You select the components you
    want to download and install later. Note that the components are rebuilt
    to some extent using the JDK you downloaded previously; so binaries will
    differ from system to system.
    5. Blackberry Android SDK Command Line Tools:
    - https://bdsc.webapps.blackberry.com/android/tool
    6. Android Marketplace App. You need 2 files:
    Vending.apk
    - Vending.apk
    GoogleServicesFramework.apk
    - GoogleServicesFramework.apk
    7. mkfs.yaffs2.arm
    - http://jiggawatt.org/badc0de/android...fs2.arm.tar.gz
    (If the link above ceases to work, you're going to have to do a search
    on the internet for it. The site names which host it keep on dying.)
    8. Modified android 1.6 system.img file
    - system.img - 4shared.com - online file sharing and storage - download

    Software Installation
    =====================
    1. Install Blackberry Desktop. Follow the prompts. You can install to the
    standard location (in Program Files).
    2. Install the DDPb Installer. Ignore error messages about dll's which
    fail to register.
    3. Install Java JDK. You can just do a standard install on this.
    4. Install Android SDK. The SDK and the Command Line Tools will be used
    in conjunction from a cmd prompt window. I created a seperate master
    directory for this on my system (d:\playbook), and let it install there
    rather than to the default directory. It installs to
    d:\playbook\android-sdk.
    WARNING: The android SDK tools installer doesn't seem to terminate properly
    in windows - it leaves dead processes kicking around which interfere with
    subsequent tasks. You might want to run task manager and make sure there's
    nothing left running when this finishes.
    5. Install Blackberry Android SDK Command Line Tools. You can install them
    by unzipping them. I installed them to d:\playbook\cmdline-tools.
    6. Start Android SDK Tools\SDK Manager.
    WARNING: It will tell you Android SDK tools is already installed. Leave
    this alone.
    - Under packages uncheck all entries.
    - Expand Android 2.3.3. Check SDK Platform.
    - Expand Android 1.6. Check SDK Platform.
    - Click Install Packages.
    Be careful - not all packages may install on the first pass. Look at
    the error messages. Make sure all checked packages are marked as installed.
    If not, rerun the install process.
    Close SDK Manager.
    7. Start Android SDK Tools\AVD Manager. Click New... This will bring up a
    screen to create a new Android Virtual Device. Give it a name (Use only
    A-Z,a-z,0-9 and no blanks.) Click the Target drop-down and select the 2.3.3
    one which appears. Give it an SD Card size of 2GB. Click Create AVD.
    Warning: This is not the fastest process in the world. Give it a couple
    of minutes to complete.
    Verify that all settings took correctly. Select the device in the main
    screen and click Edit... I have had experience where the AVD Manager did
    not take the settings correctly.
    Test the device by selecting it in the main screen and then hitting start.
    It takes a long time for the simulator to start up - several minutes.
    So be patient.
    Repeat the entire process and create an AVD for Android 1.6
    After it starts and comes to the graphic Android screen (with the little
    robot guy) close everything up.
    8. With the emulator closed, go to %userprofile%/.android/avd. Go to the
    subdirectory corresponding to the AVD you created for android 1.6.
    Copy the system.img file you downloaded previously to this directory.
    9. Now go to the directory where you installed the Android SDK to. Go to
    android-sdk\tools. Create a shortcut for emulator.exe. Right-click on
    the shortcut and select properties. At the end of the target line add
    " @<name>" where <name> is the name you created in the step above for the
    virtual device. Rename the shortcut as desired and change it's icon.
    Repeat the process for the second AVD. Move these to the appropriate
    place in the start menu.
    10. Start the AVD for android 1.6. If at any time the emulator comes
    up with a message "Slide Keyboard open to continue", press Ctrl + F11.
    (See here Android Emulator | Android Developers
    for all the shortcut keys for the emulator.)
    Login to your Google gmail account. Open the Android Marketplace and
    create an account for that.
    11. From the Android Marketplace, download and install the following apps:
    - astro file manager
    - DropBox
    Open DropBox and sign into your account.
    Using the procedure identified below as "Get Android APK File" get
    Astro.apk and Dropbox.apk and put them on your system (PC).
    Close the AVD.
    12. Create a scripts directory someplace (mine is in d:\playbook\scripts.)
    I attached a number of .bat files to this post. Copy these to the scripts
    directory. Edit each of the .bat files and review/change the set
    parameters at the beginning of the script to configure the script for
    your system.
    13. Place the following files in the apps directory (as specified by the
    set apps line in the ConfigAVD.bat file):
    GoogleServicesFramework.apk (from downloads above)
    Vending.apk (from downloads above)
    mkfs.yaffs2.arm (from downloads above)
    Astro.apk (from android 1.6 AVD in steps above)
    Dropbox.apk (from android 1.6 AVD in steps above)
    You may have to rename astro and dropbox to the format above.
    14. With the emulator closed, go to %userprofile%/.android/avd. Go to the
    subdirectory corresponding to the AVD you created for android 2.3.3.
    Delete all files except for:
    system.img (if it exists)
    sdcard.img
    userdata.img
    config.ini
    Run the ConfigAVD.bat file, either by double clicking it from explorer or
    within a cmd window. Follow the directions. This takes awhile to run.
    If all goes well, with the emulator closed, go back to
    %userprofile%/.android/avd. Go to the subdirectory corresponding to the
    AVD you created for android 2.3.3. Delete all files except for:
    system.img.new
    sdcard.img
    userdata.img
    config.ini
    Rename system.img.new to system.img.
    Start the AVD to make sure that everything works. Note that there is a problem
    with the home button. Use the ESC key in the emulator to back up to the home
    screen when needed.
    Sign into Market and Dropbox to complete setup.
    15. You should have received emails from RIM, each with a .csj file attached.
    There are 2 files of interest: RDK (Rim Development Kit) and PBDT (PlayBook
    Debug Token), both .csj. Save these 2 files to a directory of your choice.
    (I copied them to the bin subdirectory of where I put the Blackberry Android
    SDK Command Line Tools.)
    Note: You can use these files one time only to create keystore files. The
    latter files will need to be backed up immediately after creation and are then
    used for signing purposes from then on.
    I created a .bat file to simplify this process. Make sure the file is
    configured for your system. Run MakeKeys.bat. The files requiring backup
    should be copied to a backup directory as specified in the script. Save this
    directory.

    Backup Your Playbook
    ====================
    1. Connect the Playbook to your computer. If you have your Playbook configured
    with a password, you will be asked to enter that password on the PC.
    2. If prompted, enter your password on the Playbook to unlock it.
    3. Start Blackberry Desktop Software. Follow the prompts if connecting up for
    the first time. Note - the PIN number will display on the main screen.
    Save the Pin number.
    4. Select BlackBerry PlayBook on left-hand side of desktop. Select Device and
    Back Up... Select where you want to save the backup file. You can also
    change the file name as desired. Back up the device.
    5. Close out of the desktop and disconnect your device.

    Configure You Playbook for Android
    ==================================
    You have to set your playbook up to download the BBOS 2.0 Beta before you can
    run any Android apps.
    1. Backup your PlayBook. Make sure you save the PIN number for your device.
    2. Before downloading a new OS, I like to completely clear the tablet. Go
    to the settings screen, select Security (from the left-hand side), and
    then select Security Wipe. Follow the instructions on the screen. Note
    that this will also wipe out any apps you downloaded/paid for and you will
    have to reload them. If you downloaded them thru App World, you can just
    redownload them thru there. Otherwise, you will have to have a copy of
    the app on your machine and use DDPB Installer to reinstall.
    3. Go to https://bdsc.webapps.blackberry.com/...et20/register/
    and register your playbook.
    4. In about 1/2 hour (can take much longer but within 24 hours) update
    your OS. Go to the settings screen, and select Software Updates from the
    left-hand side. Click Check for Updates. Follow the instructions.
    5. Once 2.0 is installed, go to App World. Go to My World. It will show you
    which apps you had installed/paid for and re-install them. Reinstall any
    other apps using DDPb.

    Get Android APK Files
    =====================
    1. Open the AVD.
    Note: We configured 2 AVDs because many apps will not play on android 1.6.
    By the time android 2.3.1 rolled out, android market blocked many apps
    from running on the emulator altogether, so you can't even find them in
    the market. You can play with both AVDs to try to get one to download
    the desired app.
    2. Go to Android Marketplace and retrieve the desired app. Install it
    on the AVD. Close Android Markeplace
    3. Open Astro File Manager. Press Menu. Click Tools. Click Application
    manager/backup. Select desired apk files. Click backup. The apks will
    be placed in /sdcard/backup/apps. DO NOT close Astro.
    4. On Astro go to /sdcard/backup/apps. Find the app you want to get. Place
    the mouse over it and hold the click button. A menu will pop up. Select
    Send. From the next menu select DropBox. Put it where you want it.
    5. Note: Android will transfer the files with complex file names such as
    com.xxxx.yyyyy.apk. DDPB (or maybe the playbook) will not accept these names -
    you have to shorten them to something like yyy.apk.

    Convert APK File to BAR
    =======================
    1. Modify the MakeBar.bat file as required for the new apk file.
    2. Run MakeBar.bat. Note: This will create a MakeBar.log file in the bar
    directory. You may want to review that. Should the verifier report any
    errors, look in the apk directory for a file called <app name>.wrn. This
    is a text file (you have to open it in a Unix compatible editor - notepad
    will not work properly). The text file contains terse descriptions of
    incompatibilities found.

    Transfer the File to the PlayBook
    =================================
    1. Make sure the playbook is enabled for debug mode. Open the playbook and go
    to settings. Select Security from the left-hand side. Select Development
    Mode. Make sure Use Development Mode is set to ON. If a password is not
    set you may be prompted for one at this point.
    2. Plug the playbook into the PC. If prompted for a password fill it out.
    Start DDPB. Click Refresh. This will fill in the IP address of the playbook.
    Enter your password. Click Add to add an app to the list. (You can also
    check an app and click Delete to remove it from the list.) Check the app
    and select Install. When complete DDPB will pop up with a Done checkbox.
    At that point you can close DDPB and then disconnect the playbook.
    11-16-11 02:53 PM
  2. redbound65's Avatar
    Thanks Froggy500,

    I've been searching for this level of detail for the last few days.

    Red
    01-18-12 06:29 PM
  3. tuhinb's Avatar
    Hi, the vending.apk link doesn't work, any chance of getting it reuploaded? Thanks!
    09-05-12 01:25 PM
LINK TO POST COPIED TO CLIPBOARD