I'm trying to use Google's javascript API in my GWT application (to use google visualizations) and I'm having trouble referencing the google object in my JSNI. I'm getting a javascript error: "google is not defined".
I'm aware there's a GWT wrapper API for this but it doesn't have the functionality I need. I followed all the suggestions here: use visualization api of google in GWT but I'm still getting this error.
I've added this line to my gwt.xml file:
<script src="https://www.google.com/jsapi"></script>
I'm not sure where to put it so I added it below my main tag. That other stack question said to add it to add it to my HTML, so I'm assuming this is what they meant.
Here's the stripped down native method I'm calling that's producing the "google is not defined" error:
public static native void nativeJavaScriptFunction() /*-{
google.load('visualization', '1.0', {
'packages' : [ 'corechart' ]
});
}-*/;
I've also tried referencing google as "$wnd.google" and "$doc.google". I'm using the latest version of GWT 2.5.1. Does anybody else have any javascript api's working and referenced in a JSNI method?