MapView not working on Android released app (from Play Store)

I’ve developed and published an Expo app to the iOS app store as well as the Play Store. I’m using the MapView component to show a map.

The map works on:

  • iOS in Expo app (as container)
  • iOS in released app from App Store
  • Android in Expo app (as container)

But does NOT work on

  • Android in released app from Play Store

The map just shows up blank, with the Google logo in the bottom left corner.

Has anyone else experience this issue? Is there some key or flag I’m not setting properly? Please let me know if you know anything!

Thanks so much,
Patrick

1 Like

Hi Patrick!

Do you have android.config.googleMaps.apiKey set in expo.json as explained in https://docs.expo.io/versions/v17.0.0/sdk/map-view.html?

Marcus

2 Likes

I think that solved it! I also upgraded Expo to SDK 17 at the same time - so that may have done it instead…but something worked

Hey guys, having the same issues here (React Native).

MapView displays perfectly within expo development (android simulator) but not in standalone apk.

I have added the api key within my app.json file (there was no expo.json file) as shown in the documentation.

"android": {
      "package": "name",
      "icon": "./icon",
      "config": {
        "googleMaps": {
          "apiKey": "My Key Here"
        }
      }
    }

Yet standalone version just shows a grey box with the google logo in the bottom corner.

Any idea where i have gone wrong?

1 Like

can you paste your whole app.json file in? you might have put the android key in the wrong place, possibly

Here you go

{
  "expo": {
    "name": "xx",
    "description": "",
    "slug": "xx",
    "privacy": "unlisted",
    "sdkVersion": "19.0.0",
    "version": "0.1.1",
    "orientation": "portrait",
    "primaryColor": "#cccccc",
    "icon": "./assets/icons/app-icon.png",
    "loading": {
      "icon": "./assets/icons/loading-icon-pluss.png",
      "backgroundColor": "#ffffff",
      "hideExponentText": true
    },
    "packagerOpts": {
      "assetExts": [
        "ttf",
        "mp4"
      ]
    },
    "ios": {
      "bundleIdentifier": "com.xx",
      "supportsTablet": true
    },
    "android": {
      "package": "xx.android",
      "versionCode": 14,
      "icon": "./assets/icons/app-icon-android.png",
      "config": {
        "googleMaps": {
          "apiKey": "KEY"
        }
      }
    }
  }
}

Same problem here using Maps with Expo. Anyone has any idea on how to solve this?

@tponte did you follow the instructions here?
https://docs.expo.io/versions/latest/sdk/map-view.html#deploying-to-a-standalone-app-on-android

Seemed I had a problem with the apikey. I generated a new one and now it’s working.

I regenerated my for the 5th time and still doe snot work. I have read and followed the instruction for several time and still no success. Im using expo 21, I was able to make it work on my other app, which was still on expo18. I’m not sure yet if that is the issue

do you have a link to your complete source code? is it working in the expo client and just not in the standalone version of your app?

It is working great on Expo client, but not on stand-alone, it’s just empty gray background, not even logo of google maps

here is my app.json
https://gist.github.com/iamrommel/3f7df161f61aebdf17c162b46d8ef88f

and here my package.json
https://gist.github.com/iamrommel/e2599d6ec485b0d5c8da593d95d66526

and here my code that uses expo mapview
https://gist.github.com/iamrommel/e17fb50911dc5c8e7498b5eabbff7ea8

@iamrommel this might be an issue with the SHA1 fingerprint.

I provide more detail here & here, but in short I was observing a different SHA1 when I plugged an android into my computer and ran adb logcat versus when I ran keytool -list -printcert -jarfile myApk.apk on the apk generated by Expo.

I saw someone say they resolved their issue by generating a new api key, but I’m curious if your issue has to do with the SHA1 fingerprint.

I did not enable Map API in google developer console, and it’s working now, sorry if i bother everyone

I generated new API key and set the config file correctly like this:
“android”: {
“package”: “xx.android”,
“config”: {
“googleMaps”: {
“apiKey”: “KEY”
}
}
}
but on Android expo, it shows error
There was an unhandled error: Attempt to invoke interface method 'boolean abi22_0_0.com.facebook.react.bridge.ReadableMap.hasKey(java,lang.String)' on a null object reference.
Seems like it is caused from Map.
Please help me ?

Hmm, that comma in java, lang.String looks suspect to me.
Why do you think it is coming from Map?