Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Important Update for Apache Cordova and Android

DZone's Guide to

Important Update for Apache Cordova and Android

How to move onto the new beta version of Android Studio for an improved developer workflow experience.

· Mobile Zone
Free Resource

Download this comprehensive Mobile Testing Reference Guide to help prioritize which mobile devices and OSs to test against, brought to you in partnership with Sauce Labs.

Those of us who work with Apache Cordova are well aware of the issues surrounding the Android simulator. Calling it “slow” does not properly describe the painful experience of actually trying to use it. In fact, every now and then when I accidentally launch it via the Cordova CLI, I say something out loud that I don’t usually include in my blog posts. (Hint – it rhymes with duck.) How bad is it? I’ve actually recommended folks go out and buy cheap Android devices instead of using the simulator. Of course, you should always test on real devices. My point is, I’d suggest using a real device instead of the simulator since it was actually slower than going to the real device. Of course, even when I have a real device, half of my USB cables don’t properly let adb connect to it. Apparently I’m using the “wrong” USB cables. This is why I use iOS about 99% of the time for my Cordova work. I also recommendGenymotion – a free/commercial Android simulator.

Anyway, this past week Google announced the beta release of a new version of Android Studio. Android Studio is an IDE specifically for building Android applications. It is free, and kinda nice in the few times I’ve used it. As part of the update, the emulator was also improved. I didn’t pay much attention to this because “much improved slow crap” doesn’t really entice me, but then I came across this article: The new emulator in Android Studio 2.0 is 50 times faster than before. 50 is a big number so I figured, let me check it out.

First off, it was a bit hard for me to actually find the beta download. You can find it here on Android Studio’s Canary channel. I downloaded and installed the bits. I fired up the app and went to Tools/Android/AVD Manager.

shot1

I had one pre-existing AVD that was marked as needing repairing, so to make things easy I just deleted it and created a new one. Over all, the UI is a bit refresher and easier to use, but I pretty much just took defaults for my new device.

shot2

Anyway, I then dropped down to the CLI, made a new Cordova project, added Android, and told Cordova to emulate it. Surprise surprise, the new emulator popped up just fine. I suppose that is to be expected, but it was nice to see it work well.

shot3

The first launch is still not exactly speedy compared to iOS, but as I’ve seen it take 5 or so minutes in the past, it was a heck of a lot faster. The second launch was really speedy – I’d say less then 10 seconds – on par with Genymotion. (I haven’t done scientific testing, but I figure once you get below 10 seconds, it doesn’t much matter.) Genymotion though has additional benefits on top of the simulator though so you still want to check it out.

Thanks go to Mike Hartington for letting me know the new emulator worked well with Cordova, and even more thanks to Mike for sharing a video of this in action.


As an additional FYI, it can be a bit difficult to control the Android simulator in terms of rotation and stuff like that. The program menus for it are pretty much completely blank. I Googled around a bit and found results to help:Android Emulator Shortcuts. But I’m surprised the app itself seems to provide no help.

Anyway – if you’ve avoided the Android emulator like the plague over the past few years, it’s time to finally give it a shot again.


Analysts agree that a mix of emulators/simulators and real devices are necessary to optimize your mobile app testing - learn more in this white paper, brought to you in partnership with Sauce Labs.

Topics:
cordova ,android ,android studio

Published at DZone with permission of Raymond Camden, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}