Today @alexbergin and I had an issue with one of our mobile apps that simple is a cordova wrapper that loads a WebView to show a website formatted for mobile devices.
Cordova on Android 2.3 all the way up to Android 4.3 uses the stock Android browser to display applications. Luckily I have two phones I use to test.
Samsung Galaxy S4 – Android 4.3 (Jelly Bean)
Nexus 5 – 5.0.1 (Lollipop)
We could see the issues loading the stock web browser so worked out it was something to do with the WebView being used by Cordova to render the page.
Ok So how do we fix it ?
Like most things we are not first to have issues, so a little bit of google-ing pointed us to the cordova plugin webview-plus
Installing the plugin by using the cmd line didnt seems to work at time of writing this so we opted for the manual method.
We had a couple of issues when trying to build;
\build.xml:601: The following error occurred while executing this line: \plugins\com.ludei.webview.plus\android\build.xml:55: sdk.dir is missing. Make sure to generate local.properties using ‘android update project’ or to inject it through the ANDROID_HOME environment variable.
Making sure you set the ANDROID_HOME environment variable will fix that problem.
\build.xml:601: The following error occurred while executing this line: \build.xml:542: Unable to resolve project target ‘Google Inc.:Google APIs:19’
This required some extra SDK compnents to be installed as per the following blog post
We then had the app starting but then crashing before it would load anything up. This required that we did an ‘ant release’ on the plugins source as discussed in the webview project
This should then get your application up and running , we did notice we had some other error with SSL pages not showing that didn’t have a valid certificate but we simply removed https in these situations as it wasn’t important in our scenario.
Hope that helps someone else from going mad 🙂