For Developers‎ > ‎How-Tos‎ > ‎

Run Mojo Shell

On Android

Prerequisites

Before you start, you'll need a device with an unlocked bootloader, otherwise you won't be able to run adb root (or any of the commands that require root). For Googlers, follow this link and follow the instructions before returning to this page.

Environment setup:
  1. Configure your working copy to build Android binaries.
  2. Make sure you're doing a static build. Component build will not work for any of the following steps.
  3. Build and configure a proxy from your device to your local machine:
ninja -C out/Release forwarder
adb root
adb shell mkdir /data/tmp
adb push out/Release/forwarder /data/tmp/forwarder
adb shell /data/tmp/forwarder 4444:4444

you will have to run adb root and the last command again if you reboot your device

Development Workflow

Build and install the Mojo Shell APK, and run it with the Sample App.
  1. Run gyp
    • build/gyp_chromium
  2. Build the mojo_shell_apk target and push it to your device:
    • ninja -C out/Release mojo_shell_apk
    • adb install -r out/Release/apks/MojoShell.apk
  3. Build the sample application:
    • ninja -C out/Release package_mojo_sample_app
  4. Run an HTTP server on your local machine:
    • cd out/Release/apps
      python -m SimpleHTTPServer 4444 &
      cd ../../..
  5. Run Mojo Shell on the device:
    • ./build/android/adb_run_mojo_shell http://127.0.0.1:4444/libmojo_sample_app.so
  6. See what happened:
    • adb logcat

Linux & Windows

  1. Switch to the shared library build and enable aura:
    • export GYP_DEFINES="$GYP_DEFINES component=shared_library"
    • gclient runhooks
  2. Build mojo_shell and sample_app:
    • ninja -C out/Release mojo_shell mojo_sample_app
  3. Run an HTTP server:
    • cd out/Release/lib
    • python -m SimpleHTTPServer 4444
  4. Run Mojo Shell:
    • ./out/Release/mojo_shell --origin=http://127.0.0.1:4444 --disable-cache mojo:mojo_sample_app
      The value of --origin will be used for all mojo: urls, both passed on the command line and requested by the apps themselves. Specifying --disable-cache will ensure that all caching attributes are ignored, as they can cause apps to not be updated when rebuilt.
Comments