cordova-plugin-googlemaps icon indicating copy to clipboard operation
cordova-plugin-googlemaps copied to clipboard

Map not showing up on Android

Open albertleao opened this issue 10 years ago • 26 comments

I have the same piece of code working on iOS but on Android the map does not display. The map is initialized and I get the Google logo on the bottom, but nothing is displayed on the map itself

I am loading the map the standard way:


/**
 * Creates the map based on the Google sdk for android/iphone
 *
 */
var loadMap = function() {
  document.addEventListener("deviceready", function() {
    var div = document.getElementById("map_canvas");

    // Initialize the map view
    map = plugin.google.maps.Map.getMap(div);

    // Wait until the map is ready status.
    map.addEventListener(plugin.google.maps.event.MAP_READY, onMapReady);
  }, false);
}

albertleao avatar May 24 '16 18:05 albertleao

I am having the same issue. I tried to initialize it in a bunch of different ways and still nothing.

Kadajett avatar May 25 '16 00:05 Kadajett

Did you try with the master code ( not npm)?

wf9a5m75 avatar May 25 '16 03:05 wf9a5m75

Just tried and I have the same result. The master branch also won't let me build in iOS either.

I'm also not using crosswalk. Is crosswalk something that might help?

albertleao avatar May 25 '16 19:05 albertleao

Tried with crosswalk installed. Same issue.

albertleao avatar May 25 '16 21:05 albertleao

Same here. No errors, and the logo is showing. Just no panes. Tried with master and crosswalk as well. On Genymotion api 23, api 21, and two physical android devices running android 6.0.

Kadajett avatar May 26 '16 22:05 Kadajett

I face the same problem too :(

chillyprig avatar May 27 '16 11:05 chillyprig

@wf9a5m75 Have you been able to reproduce this ?

albertleao avatar May 27 '16 16:05 albertleao

@albertleao can you confirm that you have setup you Android Google Maps SDK API Key in the google developer console, with your application identifier and SHA1 fingerprint? The map won't show until the key is authorised for the particular debug/production build of your app (tied to the keystone you're using).

webprofusion-chrisc avatar May 28 '16 08:05 webprofusion-chrisc

I fix this by Enable Google Maps Android API in google developer console.

chillyprig avatar May 28 '16 09:05 chillyprig

I can also confirm displaying the map is a failure =[

Calling map.showDialog() seems to work fine though.

Installed via master branch.

roblav96 avatar May 29 '16 01:05 roblav96

Unfortunately, it's same here. I tried almost everything

  • added SHA1 finegerprint to Google Console (although it's optional)
  • regenerate api key
  • tried bunch of different SDKs (ARM, Intel, 64)
  • tried Stable branch without success (even if it doesn't help, becouse of iOS issues)
  • tried allow everything in WhiteList plugin
  • isAvailable(Function) says that Map is available

and nothing works.

david-sykora avatar May 29 '16 16:05 david-sykora

after log dump from adb logcat it seems to be without exceptions.

Google Maps Android API: Google Play services client version: 9080000 05-30 18:50:58.350 26743 26743 I Google Maps Android API: Google Play services package version: 9080470 05-30 18:50:58.928 26743 26743 E Google Maps Android API: Google Maps Android API v2 only supports devices with OpenGL ES 2.0 and above 05-30 18:51:01.758 26743 26839 D GoogleCertificates: com.google.android.gms.googlecertificates module is loaded 05-30 18:51:02.178 26743 26743 I chromium: [INFO:CONSOLE(205)] "Map is ready.", source: file:///android_asset/www/js/index.js (205) 05-30 18:51:03.031 2423 3373 V GoogleSignatureVerifier: com.cordova.quester signature not valid. Found: 05-30 18:51:03.031 2423 3373 V GoogleSignatureVerifier: [HASH]

I'm pretty sure, that I have my keystore signarure ok. Is possible that GoogleSignatureVerifier: com.cordova.quester signature not valid. is reason of this issues?

Thanks.

david-sykora avatar May 30 '16 17:05 david-sykora

@webprofusion-chrisc

Yes. I am using the correct api keys given in the developer console.

albertleao avatar May 30 '16 17:05 albertleao

Good, and your sha1 fingerprint for your keyatore and application id matches that shown in the google api console? Google check the api key is being used by an authorised app.

webprofusion-chrisc avatar May 31 '16 02:05 webprofusion-chrisc

Today I was trying to setup a quick test app to debug something and I'm unable to get the map to display as the above users. I've added the appid and SHA1 to Google. I also created a new android key and new blank cordova app and can't get the map to display on anything.

I've tried with a new key not specifying the optional SHA step, I've tried both the github and npm versions of the plugin.

In logcat I see the following verbose logs 2016-05-30 19_42_40-android device monitor

canadaka avatar May 31 '16 02:05 canadaka

After toying around with the plugin for a bit, I managed to get the map showing on Android and iOS. My logcat also displays the same message about invalid signature yet the map still shows perfectly fine.

roblav96 avatar May 31 '16 15:05 roblav96

can you post your testing project in ZIP? Or what did you change? Thanks!

david-sykora avatar May 31 '16 15:05 david-sykora

Config.xml

  <preference name="xwalkCommandLine" value="--disable-pull-to-refresh-effect --ignore-gpu-blacklist --enable-precise-memory-info"/>
  <preference name="xwalkMode" value="embedded"/>
  <preference name="xwalkMultipleApk" value="true"/>
  <preference name="xwalkVersion" value="xwalk_core_library:18+"/>

map.js

export const $map_events = new EventEmitter()
export let $map_map = null
export const $map = {
    ready: false,
}

export function $map_init() {

    $map_map = plugin.google.maps.Map.getMap( document.getElementById( 'gmap_div' ), {
        'backgroundColor': '#F9F2E7',
        'mapType': plugin.google.maps.MapTypeId.ROADMAP,
        'controls': {
            'compass': true,
            'myLocationButton': false,
            'indoorPicker': true,
            'zoom': true,
        },
        'gestures': {
            'scroll': true,
            'tilt': false,
            'rotate': true,
            'zoom': true,
        },
        'camera': {
            'latLng': new plugin.google.maps.LatLng( 39.7456066, -101.3861123 ),
            'zoom': 3,
        }
    } )

    $map_map.addEventListener( plugin.google.maps.event.MAP_READY, $map_ready )

}

function $map_ready( gmap ) {
    $map_hide()
    $map.ready = true
    console.info( '$map.init > READY' )
    $map_events.emit( 'map-ready', true )
}



export function $map_show() {
    console.warn( '$map_show' )
    $map_map.setVisible( true )
    $map_map.setClickable( true )
    document.body.classList.add( 'gmaps' )
}

export function $map_hide() {
    console.warn( '$map_hide' )
    document.body.classList.remove( 'gmaps' )
    $map_map.clear()
    $map_map.off()
    $map_map.setVisible( false )
    $map_map.setClickable( false )
}

map.css

#gmap_div {
    position: fixed;
    top: 0px;
    right: 0px;
    left: 0px;
    bottom: 5rem;
    border: 2px solid red;
    z-index: -1 !important;
}

roblav96 avatar May 31 '16 15:05 roblav96

Yah actually now looking at my app that works it also has the invalid signature messages in logcat, but it works fine. It never used to have those!

But i re-built my blank test app this morning and it works now! WTF I changed nothing overnight.

canadaka avatar May 31 '16 16:05 canadaka

@canadaka And do you use crosswalk?

david-sykora avatar May 31 '16 17:05 david-sykora