It is clear that cross compilers will not be allowed by the Apple App Store, so a developer will need to be familiar with Objective-C to create applications for the iPhone.
I was wondering, is there a cross compiler that will take Objective-C application code and rebuild it into a similar Java application that can be packaged for Android? That way, a developer could still learn just one language (obj-c) but put out applications on many devices.
I understand that the Java port would be less optimal than a natively coded application, but could conceivably save a developer some time.
Edit: Yes, the applications would be terrible. But would they not be as terrible as if they had been built by monotouch or the flash cross compiler? Couldn't those same methods be used that these cross compilers use?
I've not heard of a cross-compiler that will do what you are asking. Even if one did exists, the bigger problem would be that the frameworks (UIKit, CoreAnimation, etc) are vastly different between the two platforms. Without some sort of common frameworks, all of the code interfacing with the frameworks will have to be reworked.
This problem is solved with Apportable. It uses clang and Apple's Objective-c runtime and compiles for Android natively. It also bridges to that code with JNI in a nice way so it's accessible in Android. You don't have to convert to Java and there is no cost penalty in performance since it's compile for the native ARM architecture running on the device (it can even sometimes be faster than Dalvik/Java on the device). It also features a port of UIKit that maps everything fairly well.
Not a chance. In general, translating from a low-level language like C to a (ever so slightly ) higher-level language like Java is going lead to some very sub-optimal code.
But that's not even the worst part - you'll need to translate between two extremely-different application models as well. You'd either have to re-implement most of Cocoa Touch as a shim over Android, or try to figure out what the iPhone app is actually doing and crank out equivalent Android idioms.
A much more likely path would be something like GNUstep, but I don't know if anyone is seriously looking at implementing the UIKit layer for GNUstep, and you'd end up with a native application at the end, rather than a Java app.
There is one project, called XML Virtual Machine, that does sth similar to what you are asking. I was interested in that before i got to know the Objective-C. As far as I knew, cross compiling from Java to iPhone was possible(with some limitations). Project is still in development. You can checkout its webpage at XML VM webpage.
Maybe ppl from XML VM could answer your question(if they plan on creating cross compiling from Objective-C to Java).
But I still claim that making the application twice(for each platform using different languages and tools) would definitely give better results.
Yes, there is an app which converts Objective-C to Java. You will still need to know some Java but it saves you a lot of time porting to Android. It comes with an Android compatibility project which you can add as a dependency in eclipse. It has customizable type and method mappings and you can specify method mappings using a template system.
Check it out here... O2J - Objective-C to Java Converter
Here's their how-to video... O2J Howto Video
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With