Apportable allows developer to port their iOS application to Android easily with a very little alterations to the source code. Basically it cross-compiles Objective C or C++ code to Android NDK library. Also it includes libraries for emulating significant amount of iOS SDK APIs. Although Apportable supports UIKit to certain extent, it is intended for OpenGL applications only.
Recently, we have ported our old game title Dragons Rage to Android by means of Apportable platform. This took around 4 days total, which is pretty cool. Apportable is free if you are fine with supporting Android 4.0+ only, don't need support for expansion files and don't need or fine with implementing some useful modules like Facebook SDK, Flurry or Google Analytics yourself.
If your application uses third party library distibuted as a source code, you can try your luck and just compile it as your own code. However, if is a static library, you don't have other choice except for using its native Android version (if it exists of course). Although I would recommend this approach even if you managed to compile iOS version just fine. Since Apportable includes BridgeKit framework for interoperating with Java code, it is not as hard as it sounds.
For Dragons Rage we needed support for Chartboost SDK, which unfortunately is distributed as a static library. So we have to write some Chartboost support code for Android. It is available on github, feel free to use it for your projects.
If you want to port your own application, the first place to start is Apportable quick start guide. It is well-written, although fails to mention a few important things:
If you plan to test your application in the emulator, it is crucial that the emulator device has "Use Host GPU" option turned on:
You will just get the black screen if you don't.
Our application was built on cocos2d 1.0.1. I am not sure, if this is specific to this exact version. Loading texture in background with
[[CCTextureCache sharedTextureCache] addImageAsync:]didn't work, causing application to crash, because of thread-related issues. As a workaround we have simply rewritten our code to load UIImage in background and the create texture in the foreground thread.
Threading setup of the Apportable activity responsible for presenting is "a bit non-standard". Watch out, when trying to do something related to Android native views. In our Chartboost code we had to show interstitials on the separate activity, because Chartboost SDK didn't want to play nice with this kind of threading setup.
Unlike iPhones and iPads, Android devices come in variety of screen resolutions. With Apportable you can have some control over the way your game adapts to them by setting
[UIScreen mainScreen].currentMode. UIScreenMode is poorly documented, but a bit of experimenting will get you the desired results. It is set to
UIScreenBestEmulatedModeby default, which worked just fine for Dragons Rage, although we had to drop all our iPad-related layouts code.
So to summarize, Apportable is a nice project, which can be used to port your iOS games or other kind of OpenGL applications quickly. This comes at a cost of additional 10 Mb of libraries added to resulting APK and quite a sum of money if you want advanced features, e.g. Android 2.x support.