Friday, August 14, 2009

Google Maps working on OpenMoko FreeRunner

Getting Google Maps working on my OpenMoko FreeRunner with Android

For some reason this took me a while to get working. The basic idea is described by Sangjin Yun here, although there were a few twists perhaps related to the particular version of Android I'm using - Michael Trimarchi's freerunner-cupcake-snapshot-v15.jffs2 and uImage-v22.bin from here.

I'll take the liberty of repeating Sangjin's instructions here along with my minor modifications just so it is easy to understand.

1. Get the Maps.apk and com.google.android.maps.jar from the emulator.
You should also grab com.google.android.gtalkservice.jar from the emulator
The Maps.apk depends on the gtalkservice.

2. Enter the shell of your device.

  • adb -d shell

3. Remount the system partition with read/write permissions.

  • mount -o rw -t yaffs2 /dev/block/mtdblock3 /system

For me the remount was a bit different. The following did the trick

  • mount -o remount,rw /dev/root /

4. Copy the files to the system directory.

  • adb -d push Maps.apk /system/app/
  • adb -d push com.google.android.maps.jar /system/framework/

I needed to install the files onto my moko a bit differently. Since Maps.apk depends on the two libraries it will not install first. Here is what I did:

  • adb push com.google.android.maps.jar /system/framework/com.google.android.maps.jar
  • adb push com.google.android.gtalkservice.jar /system/framework/com.google.android.gtalkservice.jar


5. Add the permission for maps.

I found it simplest just to adb pull platform.xml onto my host, edit it there, adding an entry for both maps and gtalkservice, and then adb push it back to the phone.

/etc/permissions/platform.xml

<permissions>

...


<!-- This is a list of all the libraries available for application code to link against. -->

<library name="android.awt" file="/system/framework/android.awt.jar">
<library name="android.test.runner" file="/system/framework/android.test.runner.jar">
<library name="com.android.im.plugin" file="/system/framework/com.android.im.plugin.jar">
<library name="com.google.android.maps" file="/system/framework/com.google.android.maps.jar">
<library name="com.google.android.gtalkservice" file="/system/framework/com.google.android.gtalkservice.jar">

</permissions>


6. At this point Maps.apk will still not load because the libraries are not yet registered. Restarting the device will allow the package manager to pick up and register the two new libraries. This can easily be done using

  • adb stop

  • adb start


Alex Buntu Reported that his version of adb does not support the stop and start command.
If you can't restart your device this way you can always resort the power cycling it.
Until the new libraries are properly registered you will get
Failure [INSTALL_FAILED_MISSING_SHARED_LIBRARY] when trying to install Maps.apk


7. Now we can install Maps.apk. You should use adb install instead of adb push. push simply copies a file while install registers the package and check dependencies.

  • adb install Maps.apk


8. Now you should be able to run Google Maps on your Android Freerunner.

7 comments:

  1. The point 6 is not clear: stop and start are not recognized by my adb...
    And if I do adb install Maps.apk it says:
    "390 KB/s (966818 bytes in 2.415s)
    pkg: /data/local/tmp/Maps.apk
    Failure [INSTALL_FAILED_MISSING_SHARED_LIBRARY]"

    ReplyDelete
  2. Where did yoy get your adb binary?

    ReplyDelete
  3. Its from the 1.5_r1 SDK, version from adb --version is 1.0.20. I'll grab the 1.6 SDK and give it a try

    ReplyDelete
  4. Thanks a lot for your Howto. Its great to have Maps running on my freerunner...
    However, I needed to apply some tweaks to your text.

    The permissions section should read like the following (important are the trailing slashes and that it reads "...gtalkservice" without the 's' at the end):

    <library name="android.awt"
    file="/system/framework/android.awt.jar" />
    <library name="android.test.runner"
    file="/system/framework/android.test.runner.jar" />
    <library name="com.android.im.plugin"
    file="/system/framework/com.android.im.plugin.jar" />
    <library name="com.google.android.maps"
    file="/system/framework/com.google.android.maps.jar" />
    <library name="com.google.android.gtalkservice"
    file="/system/framework/com.google.android.gtalkservice.jar" />

    ReplyDelete
  5. Thanks so much Konrad, hope my lapse didn't cause you too much trouble.

    ReplyDelete
  6. From where did u get the com.google.android.gtalkservice.jar file.
    Reply soon.

    Thanks in advance.
    SJ

    ReplyDelete
  7. I obtained this file from the emulator. It is located in /system/framework. You can use adb to copy it from the emulator to your current directory using the command:
    adb pull /system/framework/com.google.android.gtalkservice.jar ./

    ReplyDelete