Crossplatform iPhone / Android code sharing

Solution 1:

In my experience, you can use Android NDK to compile C and C++ , so if you use iPhone Obj-C++ (.mm) bindings for a C++/C engine in the iPhone, and in Android you use Java bindings to the same engine, It should be totally possible.

So C++/C engine ( almost same codebase for Android and iPhone ) + Thin bindings layer = Portable code.

Solution 2:

Like I told someone who asked a similar question a while ago, use MVC and implement the MC in C++ and the V in obj-c or Java.

Solution 3:

Write as much as possible in plain old C (or C++ if needed) and just include the same files in Android and iPhone. Works on Windows/Mac too. "cross platform" libraries tend to consume you.

Solution 4:

You could have a go with Marmalade SDK... Compile once to native ARM and deploy to both Android and iPhone with the same binary, standard C/C++, develop on windows or mac, lots of (optional) middleware tech included.

Solution 5:

I have been working on creating applications and games for iPhone using Lua with my own framework. This way I could eventually implement the same framework for Android using Android NDK, but the actual application code would hopefully be exactly the same for both platforms.

I do not think there is an easy way to do this, because the APIs are obviously different and native programming languages are different, but building your own framework in any language that is supported by both platforms, would be my suggestion. Maybe there already is a framework that would do the hard stuff for you? If there isn't any good frameworks for doing that, then this is clearly an opportunity to implement one yourself.