Facebook And Google Bury The Hatchet (Temporarily) To Kill A Core Problem In Gingerbread Dalvik

When Facebook hit a limitation in Android’s virtual machine, Dalvik, that would halt its app development, Google and Facebook worked together to create a patch for Gingerbread. “We’re a significant app to them, and they’re a significant platform for us,” Facebook’s Director of Mobile Engineer Mike Shaver explains. It’s another example of Facebook’s hardcore mobile engineering training coming to fruition.

Today at a “whiteboard session” on Android at Facebook headquarters in Menlo Park, Shaver talked to a group of reporters about the Dalvik fix, Facebook’s relationship with Google, and how it’s turning not just software engineers but project managers, designers, and even customer support staffers into mobile developers.

url-21The turning point was when Facebook hired mobile training house Big Nerd Ranch to put employees through an intensive, 40-hour iOS and Android development crash course. Shaver said “it’s eight hours a day, five days a week. If you have a guest come, they’re sent away. Zuck can leave a message. This is what you do. People come out with their heads a little melty but they can write production code that Monday.” Big Nerd Ranch is the same squad that’s taught iOS development at Apple and Android development at Google. Facebook has trained 450 mobile engineers with the program since July.

Staffers turned mobile marines recently uncovered a huge stumbling block in Android Gingerbread, which runs on about half of all phones running Android, which on about half the phones in the world. Android’s virtual machine Dalvik, which actually runs the apps you install, had a 3 million method limit. Facebook had already hit that limit, meaning it couldn’t build any more features into its native Android app.

Shaver laid out Facebook’s three options: Stop developing its Android app, stop offering its Android app for Gingerbread users, or fix Dalvik. Luckily, “we could look under the hood and see why we were hitting this limit. Not common to be able to do this in the mobile operating system,” Shaver says, complementing Android’s openness.

So a bunch of Facebook mobile engineers spent a few weeks analyzing the problem and came up with a patch that was only about six lines of code. Shaver happily admits, “We were able to send the patch over to Google to get their opinion. They were very helpful.” Google looked at the patch for a day and gave Facebook the go-ahead. Then Facebook began testing. Shaver says the social network was able to collaborate with Google to use their test labs.

Dalvik Shaver Done

“We went from Defcon 1 and sirens, where we could no longer develop Facebook for half the Android world, to people staying up to fix it, to being able to extend the platform a bit and work with Google on it.” Without the patch, Facebook says it would have had to consider stripping out features, such as the ability to send SMS messages from Facebook For Android. Later today, Facebook will publish an engineering blog post that details the patch so other developers can use it and avoid wasting weeks butting their heads up against Gingerbread Dalvik limits.

The whiteboard session overall conveyed the idea that after being an iOS-first company for so long, Facebook is getting serious about utilizing Android’s reach to push its mission of connecting the world. While many of its employees might still prefer iPhones, Android’s low-cost and availability is making it the favorite in the nascent international markets Facebook is relying on for growth. Having devs ready to build Android, as well as having Google’s support, means it can lace social into the DNA of the open operating system.