Important Update for Apache Cordova and Android
How to move onto the new beta version of Android Studio for an improved developer workflow experience.
Join the DZone community and get the full member experience.Join For Free
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 recommend genymotion – 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.
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.
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.
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.
Published at DZone with permission of Raymond Camden, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.