Same APK for several platforms

zehazeha Posts: 36Member
edited January 2013 in General Discussion

Hi,

is it theoretically possible to build one APK that runs on a phone and on the Ouya? For me it seems like the biggest difference between a phone and an Ouya is the controller. So is it possible to e.g. call a function like getDeviceName() or something and check if it's "ouya" and then use a different input handler class etc? Or is it necessary to set up a new project / new APK for the Ouya version?

Post edited by zeha on

Comments

  • arcticdogarcticdog Posts: 235Member
    You probably could.  But the gain might not be significant in doing so, and probably adds some needless complexity and bloat to the application. The differences, although subtle, are not just the controller. OUYA has it's own Intent object, and expects Android Jellybean to be the minimum version.  If you wander around the forum, you'll see that some developers have had to modify their mobile applications that they've ported to account for some differences in the way the Tegra-3 handles memory and drawing.

    Other differences haven't altogether been identified yet either, such as how large an apk is allowed to be.  Google Play has a 50-something MB limit on an apk, which can be extended to 2GB for content by use of "expansion files".  OUYA might not support expansion files at all and opt to allow a huge apk to be deployed.  This might even allow the executable itself to be larger than 50 MB (unless there's a limitation within Dalvik that prevents that), and consequently would make the executable itself incompatible with a Google-branded Android handset.
  • DreamwriterDreamwriter Posts: 768Member
    You'd also have completely different in-app-purchase setups, which would require different menus.
  • zehazeha Posts: 36Member
    ah okay that's good to know. thanks for your replies!
  • MagnesusMagnesus Posts: 304Member
    APKs definitely CAN be larger than 50MB - some stores allow 70MB and more.

  • arcticdogarcticdog Posts: 235Member
    Magnesus said:
    APKs definitely CAN be larger than 50MB - some stores allow 70MB and more.
    That's good to know.  I wonder what OUYA will do here.  
  • Killa_MaakiKilla_Maaki Posts: 504Member
    So what's the best practice here? If we are targetting multi-platform (games released on both OUYA and Google Play, for example) should we start maintaining different forks of our codebase, one for each platform?
    You didn't remember the plot of the Doctor Who movie because there was none; Just a bunch of plot holes strung together.
  • WillzZzWillzZz Posts: 26Member
    edited January 2013
    Whatever is easiest for you. I have separate projects in my IDE and a shared repo. I have project specific source within the project directories, and shared in a  Shared/ folder. I actually have two projects, one for Web, one for Android. I have two debug/deploy configurations, one for Android and one for OUYA, but as they begin to diverge I will split them in to their own projects as well. That's worked well for me while working on multiple games and multiple platforms professionally. You might have a lot of trouble parallelizing work and merging branches with shared code changes from multiple parties if you're not all merging back to the same branch. Better to commit once, merge once than do it potentially multiple times. (One master branch, n working branches, every merges back to master, which ideally has some form of CI hooked up to it) But back to the first sentence: Whatever is easiest for you.
    Post edited by WillzZz on
  • arcticdogarcticdog Posts: 235Member

    So what's the best practice here? If we are targetting multi-platform (games released on both OUYA and Google Play, for example) should we start maintaining different forks of our codebase, one for each platform?
    This will depend upon the development environment.  For instance, I'm using MonoGame/XNA plus a framework/engine I've developed that sits on top of that, as well as a tool I've developed that manages and syncs project code and content for you and gets rid of all the file dependency fiddling.  Since this is C#, conditional compiling is available and allows you to include/exclude platform specific code when building.  I believe Unity also has this capability since it is also using C#/Mono.

    For Java, the best you can do is akin to what @WillzZz is doing.  
    Where possible, abstract as much common code as you can into base classes and hide platform specific implementations behind interfaces and factory classes.  Then tie it altogether appropriately with "make" script files specific to the platform you want to build.   


Sign In or Register to comment.