Feeds

Google offers tool to bridge Android and iOS app dev

Translates Java code to Objective-C

SANS - Survey on application security programs

Google has released a tool aimed at making it easier to port software between the two major smartphone platforms, by converting Java code for Android into Objective-C code that can be compiled to run on Apple iOS devices.

"J2ObjC is not a Java emulator," writes Google's Tom Ball in a post announcing the tool, "but instead converts Java classes to Objective-C classes that directly use the iOS Foundation Framework."

The tool doesn't claim to make writing mobile apps a completely cross-platform affair. For one thing, it only handles the back end. Developers who use it to translate their apps will still need to write new UI code in Objective-C using Apple's iOS SDK.

Using J2ObjC, however, developers can code their core non-UI functionality in Java, then compile versions of those portions of their apps for both Android and iOS from a single code base, rather than maintaining a separate code tree for each platform.

In fact, Ball says, they can even use the same Java code to build web-based versions of their apps using the Google Web Toolkit (GWT), which can translate Java code into JavaScript to run in the browser. All three versions would have identical core functionality, because they would be based on the same source code.

Google says J2ObjC works with most build tools, including Xcode and Make, and that the translation from Java to Objective-C is totally automated. No additional editing of the Objective-C source code output by the tool is necessary.

Ball says J2ObjC supports the full Java 6 language and many of its key runtime features, including exceptions, generic types, threads, reflection, and inner and anonymous classes. It even does a fair job of modeling Java-style memory management in Objective-C. A full list of the supported language translation features is available on the project's website.

To build and use the system, developers will need a machine running Mac OS X 10.7 (Lion) or higher with Xcode 4 or higher and JDK 1.6 installed, plus Apache Maven.

As for how well it works really, Google says the project is "currently between alpha and beta quality," with the initial release given version number 0.8 as an indication of its release status.

"Several Google projects rely on [J2ObjC], but when new projects first start working with it, they usually find new bugs to be fixed," reads a statement on the project homepage. "Apparently every Java developer has a slightly different way of using Java, and the tool hasn't translated all possible paths yet."

If you'd like to join the bug hunt, the full source code for J2ObjC is available now under the Apache open source license. ®

High performance access to file storage

More from The Register

next story
This time it's 'Personal': new Office 365 sub covers just two devices
Redmond also brings Office into Google's back yard
Oh no, Joe: WinPhone users already griping over 8.1 mega-update
Hang on. Which bit of Developer Preview don't you understand?
Microsoft lobs pre-release Windows Phone 8.1 at devs who dare
App makers can load it before anyone else, but if they do they're stuck with it
Half of Twitter's 'active users' are SILENT STALKERS
Nearly 50% have NEVER tweeted a word
Internet-of-stuff startup dumps NoSQL for ... SQL?
NoSQL taste great at first but lacks proper nutrients, says startup cloud whiz
IRS boss on XP migration: 'Classic fix the airplane while you're flying it attempt'
Plus: Condoleezza Rice at Dropbox 'maybe she can find ... weapons of mass destruction'
Ditch the sync, paddle in the Streem: Upstart offers syncless sharing
Upload, delete and carry on sharing afterwards?
New Facebook phone app allows you to stalk your mates
Nearby Friends feature goes live in a few weeks
Microsoft TIER SMEAR changes app prices whether devs ask or not
Some go up, some go down, Redmond goes silent
prev story

Whitepapers

Securing web applications made simple and scalable
In this whitepaper learn how automated security testing can provide a simple and scalable way to protect your web applications.
3 Big data security analytics techniques
Applying these Big Data security analytics techniques can help you make your business safer by detecting attacks early, before significant damage is done.
The benefits of software based PBX
Why you should break free from your proprietary PBX and how to leverage your existing server hardware.
Top three mobile application threats
Learn about three of the top mobile application security threats facing businesses today and recommendations on how to mitigate the risk.
Combat fraud and increase customer satisfaction
Based on their experience using HP ArcSight Enterprise Security Manager for IT security operations, Finansbank moved to HP ArcSight ESM for fraud management.