Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Phonegap Error: google is not defined

I have a PhoneGap application for iOS and Android which finds local ATMs. My Android version was running just fine until this week when it seems like Google changed some of the ways PhoneGap projects need to be built.

I now get an error which says: 03-11 09:30:03.698: E/Web Console(8768): Uncaught ReferenceError: google is not defined at file:///android_asset/www/js/map.js:36

When I run this file on my Desktop browser everything works fine. For some reason this is no longer working on the phone.

I have tried using multiple different calls to the Google API including:

<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?key={API_KEY}&sensor=false"></script>
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?&sensor=false"></script>

These worked perfectly last week on Android. These still work on iOS and my desktop Browser.

The specific line of code the error is pointing at is:

geocoder = new google.maps.Geocoder();

Which is the first call I make to the Google API.

Any help would be greatly appreciated.

like image 543
Bullyen Avatar asked Sep 11 '26 05:09

Bullyen


1 Answers

Make sure that you include the Google Maps domain in your whitelist ;)

like image 185
MBillau Avatar answered Sep 12 '26 20:09

MBillau



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!