Wednesday, January 9, 2013

Stumbling my way to "Hello World" on OUYA

DISCLAIMER:
This entire blog post is a work of art and not an actual guide.

Please refer to other, more knowledgeable sources if you are actually interested in developing apps on OUYA.

Here are some good places to start:

First off, the official OUYA Developer Portal:
https://devs.ouya.tv/developers

The official ODK forum:
http://forums.ouya.tv/categories/odk

A nice set of youtube videos by metaPhx describing getting AndEngine and a Nexus 7 working:
http://www.reddit.com/r/ouya/comments/16dwra/potential_devs_i_created_an_uptodate_complete/




Developing an OUYA app from absolute zero knowledge of programming for Android or OUYA!


Downloaded and extracted the following to C:\OUYA-dev\

odk-0.0.4.zip
adt-bundle-windows-x86.zip
eclipse-mobile-juno-SR1-win32.zip http://eclipse.org/mobile/

Followed this tutorial about creating an android project from scratch:
http://developer.android.com/training/basics/firstapp/creating-project.html

Start Eclipse:



Install ADT Plugin
http://developer.android.com/sdk/installing/installing-adt.html

Realize the adt-bundle already came with eclipse :)
oh well.

Not sure what I've gotten myself into!
Click New
"Use the Android API Level 16 (Android 4.1 "Jelly Bean") when developing for the OUYA Console."
https://devs.ouya.tv/developers/docs/setup

Created a new Android Virtual Device in eclipse... started with Galaxy Nexus because it has high resolution.

Started the emulator, waited for jellybean to boot. (had a memory allocation error so I reduced the virtual device RAM to 512MB)
Unlocked the emulated device and chose to run my app from eclipse...
(You can see I also dragged a checkbox into my app)

If I click the android app button in the emulator I can see my awesome creation sitting there!







Now I have to figure out how to incorporate the OUYA sdk files... this looks like some work.

from ouya.tv:
In order to use the OUYA API you will need to include ouya-sdk.jar in your project libraries, as well as guava-r09.jar and commons-lang-2.6.jar. These can be found in the libs directory. 

Need to figure out how to include these jars in my project...

Since I don't know what I'm doing I just dragged the files over the "libs" folder on the left side of the eclipse interface and chose to copy the libraries into my project.

Okie doke... there they are


Yeah, so I'm not sure what to do so I'm just going to try to create the OUYA virtual device.

Opened the Android Virtual Device Manager and chose the Device Definitions tab, clicked "New Device" button:
from ouya.tv:
Emulator
If using the emulator, configure the Android virtual device as follows:
  • Resolution: 1920x1080 or 1280x720, as desired
  • Hardware Back/Home keys: yes (you will need to add this to the hardware parameters)
  • D-Pad support: yes (you will need to add this to the hardware parameters)
  • Target: Android 4.1 - API Level 16
  • CPU/ABI: Intel Atom x86
  • Device RAM size: 1024
Only 512 RAM because of the previous error I had.

Wow... I realize I've probably created the worst tutorial for anything, ever. Sorry.

Since I want to install some APKs via adb onto the emulator I had to add the android SDK directories to my PATH variable in Windows XP.


C:\OUYA-dev\adt-bundle-windows-x86\sdk;C:\OUYA-dev\adt-bundle-windows-x86\sdk\tools;C:\OUYA-dev\adt-bundle-windows-x86\sdk\platform-tools

soooo...  now I should be able to easily install the ouya-launcher.apk via adb.

apparently the path variable isn't immediately updated :(
Oh well, still able to just use the full paths.

C:\OUYA-dev\adt-bundle-windows-x86\sdk\platform-tools>adb install C:\OUYA-dev\OUYA-ODK\ouya-launcher.apk

All right! Now what? There appears to be a timer and a stopwatch if you arrow left or right?

may as well install teh ouya-framework.apk
C:\OUYA-dev\adt-bundle-windows-x86\sdk\platform-tools>adb install C:\OUYA-dev\OUYA-ODK\ouya-framework.apk

OK, hit escape to get out of the stopwatch thing, not sure why it chose to run that. Found the OUYA launcher in the app list and launched that. success!

I feel like a damn wizard at this point, even though I know I've barely scratched the surface.
Down arrow to "skip pairing" and it's the Julie Uhrman video, plays like a slideshow on my computer.


 Now it's just stuck at the Contacting OUYA servers... screen :(

 Apparently if you wait about 5 minutes it times out, yay!

 Well, I don't have the buttons configured correctly so I'm stuck on this screen, time to restart the emulator
Update: actually I wasn't stuck, you can click on the little round buttons using the mouse.
Changed some settings to the AVD anyway



 Chose menu - devs - software... hmmm my app isn't there... oh yeah... because I haven't ran it from eclipse yet.
Chose the "run configurations" from eclipse and changed the target to "always prompt" so it wouldn't try loading the Nexus AVD that I created earlier.

My app came up, I was able to hit escape and get back to the OUYA frontend, reload the "devs - software" menu and now I see it!


Runs like I don't know what I'm doing, showing the android menu bar and I'm not sure why I have a black border on the right side of the emulator. HELLO WORLD!


all the entries