How to setup Ouya ODK

Sat, 01/12/2013 - 11:02
Eric Marty

So I have no idea how this will go. This could just as easily become a 'How not to setup the Ouya ODK' but you can follow along in the adventure as I try to figure this out.

Ok so this is what I have setup already:

> Java Runtime Environment
Eclipse IDE for Java Developers
Android SDK
Android ADT for Eclipse

 

1. Download and extract the Ouya ODK

https://devs.ouya.tv/developers/odk

 

2. It's been a minute since I've played with Android development so I'm going to create a new workspace for Ouya projects in Eclipse.

 

3. Open up Ouya Documentation

https://devs.ouya.tv/developers/docs/setup

 

4. Remember where your android sdk directory is

Ok I found something in my user root. Popped open the terminal and a quick pwd shows /Users/eric and a quick ls -la reveals the hidden android directory .android. Looks like it's all local user stuff. So lets dig on. Looks like it's located in Applications/android-sdk-macosx/

 

5. So it looks like the next thing is to launch the Android SDK

Lets see here you can cd into the tools/ directory and run the command found in the Ouya documentation, ./android sdk, or you can just use Eclipse! You can launch the Android SDK Manager through a little toolbar icon in Eclipse. Launching or running the command brings up this.

Ummm.. so no idea what to do from here. It looks like the Ouya is partial to Android 4.0 (API 14) & 4.1 (API 16) thanks Ouya developer docs but it looks like my android tools are out of date so im going to update.

 

6. Update Eclipse and Android SDK if needed

Eclipse > Help > Check For Updates and it looks like just about everything needs an update. So I'll just accept and let it roll. At this point you can just use your imagination to see a screen of Eclipse updating itself. Next, update Android SDK through the SDK Manager.

Like 9 hours later the updates are complete.

 

7. Install the required android sdk components

Launching the Android SDK Manager. Check the Tools, Android 4.0, Android 4.1.2, Extras > Android Support Library and install them.

 

8. Add path variables

cd into your user root directory cd ~. The mac doesn't create a .bashrc for you so if haven't already made one you will have to create a new one. So from your user root vim .bashrc. Copy and paste these lines into the file.

 

export PATH=$PATH:~/android/android-sdk-macosx/tools
export PATH=$PATH:~/android/android-sdk-macosx/platform-tools
export ANDROID_HOME=~/android/android-sdk-macosx

Hit Esc then :wq to write and quit.

9. Creating a project targeted to Ouya

Alright so switching back over to Eclipse. File > New > Android Application Project

 

10. Add the Ouya libraries

Once the project is setup right-click the libs folder and go to Import. Click General > File System

Browes to your OUYA ODK directory and add the follow libraries from the libs folder:

> ouya-sdk.jar
> commons-lang-2.6.jar
> guava-r09.jar
 

11. Open some more OUYA documentation

From your OUYA ODK directory go to Samples > iap-sample-app and open the README.txt

While we're at it I'm going to check out the manifest file. AndroidManifest.xml

 

12. Setup Android Manifest file

Now open your projects AndroidManifest.xml and lets compare. Ok so I'm going to grab the supports-screens stuff and pop it into my manifest file.

 

<supports-screens
        android:smallScreens="false"
        android:normalScreens="false"
        android:largeScreens="true"
        android:xlargeScreens="true"
        android:anyDensity="true"
        />
 
And lets go ahead and replace our intent filter with the one from the documentation
<intent-filter>
    <action android:name="android.intent.action.MAIN"/>
    <category android:name="android.intent.category.LAUNCHER"/>
    <category android:name="ouya.intent.category.GAME"/>
  </intent-filter>

Alright well that looks good.

 

13. Install Intel x86 Emulator Accelerator (HAXM)

Also, taking a look at the documentation because we love our documentation, it looks like we want to install the intel ham emulator before we create the virtual device.

Ok now that we've installed the intel ham emu lets get back to the device manager

 

14. Create Device Definition

So Ouya has provided some specs for creating a Ouya-like device. But before we can actually create the virtual device we need to define it. Click on the little andriod phone icon in Eclipse to pull up the Android Virtual Device Manager and select the Device Definitions tab. Click New Device

This screen shows my best guess for emulating the Ouya. A quick search through the documentation reveals some spec info that is useful.

> 1 GB RAM
> 1280x720 720p or 1920x1080 1080p
> xhdpi

Looking at it I will probably create two device definitions. One titled OUYA 720p and one OUYA 1080p. Also, I'm not sure if forcing landscape is the best idea and I chose 13.3 screen size becuase that's the size of many laptop screens that have 1280x720 res screens.

15. Create OUYA virtual device

With the Android Virtual Device Manager open, lets create a new virtual device. Click the New button.

We want to use the OUYA device profile we just made as the Device. Target is Android 4.1.2/API 16. We added the intel ham I'm not going to stop calling it that so lets use it as is suggested by the Ouya documentation.

 

16. Setup run configuration

Alright lets hit the run button and see what happens / doesnt happen. Alright so we need to setup a Run Configuration. So hit the run button and set up new run configurations.

Set the name and Add your project under Android > Project. I also flipped over to the Target tab and hit Always prompt to pick device becuase in my experience the device launcher is buggy this alleviates that a bit.

17. Run the project

Alright so hit the Run button (white arrow - green circle), select Launch a new Android Virtual Device and select the Ouya device. Hit the Start button.

Check the Scale display to real size. Set your screen size and hit the question mark next to Monitor dpi to let the Launcher fit the dpi to your screen or at least i think that's how it works

Now hit Launch

Hello world!

18. Install Ouya apks

Now that we have our giant emulator lets turn it into a Ouya or Ouya-like virtual device. Ok so we have two apks to install. It looks like the first is the Ouya framework and the second is the Ouya program that runs the interface and Ouya frontend stuff. So now that the emulator is running we can use the command line to install the apks. Here are the suggested commands:

 

adb install -r ouya-framework.apk
adb install -r ouya-launcher.apk

For me, adb isn't known or I don't have a path set or whatever, so I just navigated over on to the directory that holds the adb program and ran the command from there.

./adb install -r ~/Dropbox/Projects/OUYA/OUYA-ODK/ouya-framework.apk
./adb install -r ~/Dropbox/Projects/OUYA/OUYA-ODK/ouya-launcher.apk

19. Run Ouya program on emulator

I either hit the back button or the home button but I was presented with this screen.

I selected OUYA Launcher and Always and was rewarded with this screen:

 

20. Create new user

After waiting for a second and looking at the sweet looking Ouya controller the next screen requires you to create a user account.

Enter some info and check your email to verify you account.

And done. Ouya developer portal access!