OUYA emulator setup

After finishing my custom OUYA image store , I'm out to actually build an application that runs on the OUYA.

OUYA's developer documentation let setting up the development environment seem to be a breeze, but in reality it isn't (anymore).

AVD setup

One may use the standard Android SDK to emulate the OUYA hardware and develop on it. The Android Virtual Device (AVD) instructions are pretty complete:

Resolution
1920x1080
Hardware Back/Home keys
yes
D-Pad support
yes
Target
Android 4.1 - API Level 16
CPU/ABI
Intel Atom x86
Device RAM size
1024 MiB

The only thing that did not work here on my laptop was the resolution; the android emulator only showed a black screen (not even a boot logo) on any resolution higher than approx. 1280x800. The error message I got via adb logcat was:

E/SurfaceFlinger( 1077): Display subsystem failed to initialize.
check logs. exiting...

Android tries to start SurfaceFlinger again and again, but that does not help. Increasing RAM did als not seem to help.

ODK setup

The OUYA developer kit ODK is freely downloadable from the OUYA website, I started with version 1.0.7, while 1.0.8 is now the current one.

The ODK gives you two android packages: ouya-framework.apk and ouya-launcher.apk. Install those two packages in your android emulator, and you can test your game in near-real conditions as they would run on the OUYA hardware.

The first time after booting the emulator I'd get Cannot play video, but this message only tells us that the OUYA intro video can't be played.

The real problem is another one: When starting the OUYA launcher application, I would only get a message:

Unfortunately, OUYA Launcher has stopped.

The logs, obtainable via adb logcat, shows more details:

I/ActivityManager: Start proc tv.ouya.console
    for activity tv.ouya.console/.launcher.OverlayMenuActivity:
E/AndroidRuntime: FATAL EXCEPTION: main
E/AndroidRuntime: java.lang.RuntimeException:
    Unable to start activity ComponentInfo
    {tv.ouya.console/tv.ouya.console.launcher.OverlayMenuActivity}:
    java.lang.RuntimeException: OOBE not installled
E/AndroidRuntime: at android.app.ActivityThread.performLaunchActivity
E/AndroidRuntime: at android.app.ActivityThread.handleLaunchActivity
[...]
E/AndroidRuntime: Caused by: java.lang.RuntimeException: OOBE not installled
E/AndroidRuntime: at tv.ouya.console.launcher.startup.OOBEUtils.getOOBEPackageName
E/AndroidRuntime: at tv.ouya.console.launcher.startup.OOBEUtils.startOOBE
E/AndroidRuntime: at tv.ouya.console.launcher.startup.OOBEUtils.startCreateUser
E/AndroidRuntime: at tv.ouya.console.launcher.OverlayMenuActivity.onStart
E/AndroidRuntime: at android.app.Instrumentation.callActivityOnStart
[...]

The OUYA developer forum has several threads about this error, without a solution:

Obtaining OOBE

I have no idea what a OOBE is, or why I need one - but the launcher apparently does. The launcher on my hardware OUYA seems to have one, so simply using that could work.

After playing around with the USB cable and adb ls, I found it at /system/app/OUYAOOBE.apk. Getting the file is easy:

$ adb pull /system/app/OUYAOOBE.apk OUYAOOBE.apk

Then I tried to push it on the emulator. /system/ is mounted read-only and also has no space left, so I pushed it into /data/app/.

Unfortunately this did not work out, as android complained about missing permissions in the logs:

E/AndroidRuntime: FATAL EXCEPTION: main
E/AndroidRuntime: java.lang.RuntimeException:
    Unable to start activity ComponentInfo
    {tv.ouya.console/tv.ouya.console.launcher.OverlayMenuActivity}:
    java.lang.SecurityException: Permission Denial: starting Intent
    { flg=0x14000000 cmp=tv.ouya.oobe/.OOBEController (has extras) }
    from ProcessRecord{b3c2f0b0 1513:tv.ouya.console/u0a44}
    (pid=1513, uid=10044) requires tv.ouya.permission.START_OOBE
E/AndroidRuntime: at android.app.ActivityThread.performLaunchActivity
[...]
E/AndroidRuntime: Caused by: java.lang.SecurityException:
    Permission Denial: starting Intent
    { flg=0x14000000 cmp=tv.ouya.oobe/.OOBEController (has extras) }
    from ProcessRecord{b3c2f0b0 1513:tv.ouya.console/u0a44}
    (pid=1513, uid=10044) requires tv.ouya.permission.START_OOBE
E/AndroidRuntime: at android.os.Parcel.readException
[...]

Since I am a complete newbie to android development, I gave up and did not follow that route any further.

Older ODKs

Another OUYA developer forum thread gave me the idea to try out an older version of the ODK, since at least one of those worked with the emulator. The official docs only link to the latest version, but a quick search gave me the non-keyed Amazon AWS URLs: https://devs-ouya-tv-prod.s3.amazonaws.com/odk/odk-1.0.5.zip . You can download any version from 1.0.0 to 1.0.8.

Version 1.0.4 worked somehow but crashed when entering the "Play" menu item, and 1.0.6 already wants the OOBE.

1.0.5 seems to be stable enough to play with. Unfortunately, you can't use the OUYA store with it ("Discover") since the JSON format changed in the meantime.

Other people suffering from this problem

Written by Christian Weiske.

Comments? Please send an e-mail.