Sideload Apps that use Google Maps API with this APK hack!

BlackBerryZ10-lifestyle3

The new adventure of “sideloading” has certainly taken on quite an evolution:

  • Back since OS 2 of the Playbook and the early days of BB10, we were able to quickly sideload simple apps – but not apps using Android native code.
  • Along came what has become known as “the xsacha method” to use the DebugToken to sideload apps that use native code, such as Angry Birds
  • For me, there were still a bunch of apps that didn’t work until AT&T graced me with the OS 10.1 upgrade
  • Along came the solid 10.2 leak which suddenly opened the door to even more Android apps that required a higher version of the Android OS than the Gingerbread that 10.1 had to offer, e.g. Feedly
But there has still always been a tremendous void. A whole handful of simple apps just would not work. Using Catlog (when it still worked – I believe tighter security in Jelly Bean blocks it from reading logs in 10.2 without root) it was apparent that the failure was due to the apps expecting the Google Maps API which is not baked into BB10’s Android runtime. I had simply resigned myself to the reality that those apps would just never work.
…Until now! I stumbled upon yet another CrackBerry Forum post which lead me to a solution. In a nutshell, the AndroidManifest.xml file contains directives as to which libraries to expect and, more importantly, whether or not they are required. I will document the steps to modify the APK file so that the missing libraries are no longer required. For the purposes of keeping this as brief as possible, I will have to assume you are already familiar with how to obtain an APK and “the xsacha method.”
  • First, download and unpack the APKTool application
  • Place the APK you want to modify in the same directory. Let’s call the APK Foo.apk
  • Get a Command Prompt in that directory (Shift+Right-click, Open Command Window Here should work in recent versions of Windows)
  • Type the following command:
    apktool d Foo.apk Foo

    This will create a sub-directory called Foo and decode the APK contents into it. Don’t close the Command Prompt just yet.

  • Go into the Foo directory and open the AndroidManifest.xml file in your favourite text editor
  • If the Google Maps API is the only problem, you are looking for the following line:
    <uses-library android:name=“com.google.android.maps”/>
  • Modify it to look like so:
    <uses-library android:name=“com.google.android.maps” android:required=“false”/>
    (Repeat this process for any other required library which might be causing problems.)
  • After saving the XML file, go back to the Command Prompt. Type the following command to repackage the APK to Foo2.apk:
    apktool b Foo Foo2.apk
  • I wish I could say we were done. But unfortunately, I’ve found that since the resulting, modified APK is not signed, it will fail when you try to convert it to a .BAR
  • The simplest way around I found, based on this YouTube video was the SignAPK app. Follow the instructions in the video description to download and unpack the utility.
  • NEW: I’ve added one step to make using SignAPK that much easier. In the the SignAPK directory, add a batch file, SignAPK.bat with the following code:
    java -jar signapk.jar certificate.pem key.pk8  %1 %~n1-signed.apk

    Now, simply place Foo2.bar in the same directory and drag-and-drop it onto SignAPK.bat. This will automatically produce Foo2-signed.apk. The next step is no longer necessary.

  • Place Foo2.bar in the same directory and run the following command in a Command Prompt:
    java -jar signapk.jar certificate.pem key.pk8 Foo2.apk Foo2-signed.apk
  • (Obviously, you need to have Java on the machine for that to work but anyone who’s come this far almost certainly does.)
That’s pretty much it! Foo2-signed.apk is now ready to run through the standard APK-to-BAR conversion process and sideload to your device. I’ve used this method to successfully sideload and run apps such as Dunkin Donuts, 7-Eleven and Geico. It should be noted that these apps do contain functionality that relies on Google Maps (such as “Find the nearest …”) and if you try those, the app will crash. Have fun! DFTBA!
33 total comments on this postSubmit your comment!