Hi Philippe, It would be nice to be able to use Objective-C libraries on Android, e.g. to port IPhone applications.
Have you looked at Cocotron (http://www.cocotron.org/)? They have an implementation of various Cocoa frameworks that work on both Windows and Linux. I don't think they started to work on UIKit or IPhone specific parts. I don't think that the Android platform will have ObjC support officially in the foreseeable future. So if you want to be able to develop for consumer devices (that are not explicitly customized to allow ObjC apps), then each application will need to include the ObjC runtime + libraries. This probably means static linking, and some magic to initialize the Objective-C runtime from the Java side, because last I checked, application lifecycle management was only exposed in the Java API. Of course, such applications would be larger, but the same has been done for IPhone as well, for example with MonoTouch where the whole .NET runtime is packaged with the applications. Regarding Android API / UI integration: It is probably a good idea to look at how the Android Scripting Engine integrates different languages to the regular Android API. With a sufficiently generic Java-ObjC API bridge you can write Android applications in Objective-C, and possibly reuse already existing ObjC / IPhone libraries. Then, when you have a thin Objective-C wrapper over the Java API, you can try to build a UIKit wrapper, so that IPhone applications can be ported with minimal source changes. FYI: The XMLVM project (http://www.xmlvm.org) is doing something very similar, but the other way around: It allows cross-compilation of Android applications to native IPhone / Objective-C applications. It has Android API emulation, also a Java wrapper for IPhone APIs, plus an ObjC implementation of the Java Runtime (java.lang, java.util ...). Of course it is not yet complete, but it is actively developed. (We are using it in one of our projects.) Best Regards, Gergely On Thu, Dec 31, 2009 at 7:00 AM, Philippe Hausler <[email protected]> wrote: > * Post moved from android-platform group * > > First off let me give some background about myself and my inquiry: I > am an iPhone developer, and I am an Android developer. I have > recently > embarked on a potentially interesting side project that others may > see > some use to. Just as a preamble, I am not looking to have any sort of > feedback on the benefits of Java versus Objective-C either > linguistically or efficiency etc. I am looking for viability of how > this can be accomplished. > > In this project I have started, I have successfully compiled, tested, > and verified a variant of the Android NDK to build ObjC binaries for > the Android platform. After coercing the compiler to do my bidding > (along with hammering Xcode to recognize the new platform), my next > trick will be making a code compatible port of some of the base > frameworks from iPhone to the Android platform. I need suggestions on > the path of implementation for a few fundamentals... > > Dynamic Libraries or Static? > Should my port build the framework libraries as dynamic and if so, > how > and where would they ideally be stored on the device? > If the frameworks should be static library inclusions into the built > applications, will this have a horrific adverse effect of the device > limitations per installed application size (my best guess is that it > will be an issue)? > > Inherited UI or ported UI? > If I am successful in the port of Foundation, the next logical step > will be UIKit. I am a firm believer in consistency of the user > experience for operating systems, so a tie-in to the native UI would > be the best route in my opinion. This poses a quandary, how can a c/c > + > +/objc application bind into the Java based UI? Is there a lower > level > hook point for this? Can the JNI be bi-directional for connections to > UI elements? > > The overall aim to this project is somewhat academic at the moment, > however for the concept of speed of porting applications to multiple > platforms this would definitely be quite attractive to developers > currently developing for iPhone and wanting to migrate to the android > platform. > > I would love to hear any constructive ideas in regards to these > issues. > > -- > unsubscribe: [email protected] > website: http://groups.google.com/group/android-porting -- unsubscribe: [email protected] website: http://groups.google.com/group/android-porting
