Geertjan's Blog

  • September 22, 2014

From Knockout with Java EE via Cordova to Android Emulator via Genymotion

Geertjan Wielenga
Product Manager

I've blogged about Genymotion before, to me it's simply a fantastic Android emulator. Now I'm able to deploy a Knockout front-end via ADB to Genymotion, while the Knockout front-end is able to make a connection to a REST back-end:

What you see above is Genymotion, displaying a Knockout front-end, that connects to a REST back-end running on localhost, while exposing the Manufacturer table from the Derby 'Sample' database that is part of NetBeans IDE and GlassFish.

I used Cordova tools integrated in NetBeans IDE 8.0.1 (and a few releases before that those tools have been there too) to create the Android APK file from the Knockout sources (i.e., from the HTML, JS, and HTML).

On top of everything else, this is a small teaser for a session JB Brock and I are doing at JavaOne: "Coding for Desktop and Mobile with HTML5 and Java EE 7" (Monday, Sep 29, 2:30 PM - 3:30 PM - Hilton - Continental Ballroom 6).

I've also installed a NetBeans plugin I blogged about sometime ago for deploying an APK directly from NetBeans, i.e., when the menu item below is clicked, ADB is called, which installs the APK onto Genymotion:

The above does nothing more than 'adb install -r' on the APK file, so it's not a big deal, but small and handy to have.

In all this, I've had to set up Genymotion from scratch (since I have a new laptop, on which I hadn't set up Genymotion yet), for which the following were helpful insights:

  • In the Genymotion 'Settings' tab, there's an ADB section, where you can register the Android SDK.
  • Instead of localhost:8080, use in all your client-side calls, i.e., search in your client-side code for 'localhost' and change it to, which is the default Genymotion protocol.
  • Probably you'll also need to switch off the firewall and anti-virus software, if problems continue.

Be the first to comment

Comments ( 0 )
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.