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

#1

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

2 Likes
#2

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
#3

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

#4

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?

#5

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

#7

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"
        }
      }
    }
  }
}
#8

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

#9

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

#10

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

#11

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

#12

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?

#13

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

and here my package.json

and here my code that uses expo mapview

#14

@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.

#16

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

#17

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 ?

#18

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