Cordova-plugin-googlemaps: Grey Map but api key is set up how adviced

Created on 2 Apr 2021  路  3Comments  路  Source: mapsplugin/cordova-plugin-googlemaps

I'm submitting a ... (check one with "x")

  • [ ] question
  • [x ] any problem or bug report

OS: (check one with "x")

  • [ x] Android
  • [ ] iOS
  • [ ] Browser

cordova information: (run $> cordova plugin list)

cordova-plugin-googlemaps 2.7.1 "cordova-plugin-googlemaps"
cordova-plugin-whitelist 1.3.4 "Whitelist"

Current behavior:

First I have created a google maps api key. I didn麓t restrict the key.
Then I created a completely new cordova project and exactly followed the "Hello World" guide. The only thing I did additionally was adding: to my config file because else the project wouldn麓t run. When I run the program only a grey map shows with the google logo at the bottom. In the logcat it said it was an authorization failure. I know that the problem has something to do with my api key but I can麓t figure out what. The weird thing: if I generate a google maps project with android studio my key works and the map shows. But with cordova and this plugin it doesn麓t work.
What I already did:
I enabled "maps sdk for android" and "maps sdk for ios"
I created the key after enabling the api and I have already regenerated my key multiple times
I tried to run it with a restricted key instead of an unrestricted one. I used the right fingerprint but it also didn麓t work
I normally try to run the project on an emulator (which has google play activated) but I also tried to run it on a real device with the same result

I searched the web for hours now but I can麓t find a solution. I would be very thankful if anybody could help me.

Expected behavior:
The plugin should work and show a map

Screen capture or video record:
Screenshot 2021-04-02 115041
Screenshot 2021-04-02 115142
Screenshot 2021-04-02 115207
Screenshot 2021-04-02 115246
Screenshot 2021-04-02 115542

https://github.com/BTW18/test.git
I have never shared a project. Is this the right link?

Support this plugin activity

I appreicate if you give me a beer :beer: from here

Most helpful comment

I can't believe it. I spent hours on this. I tried everything. But I always set the key within the "()". I feel so stupid right now. It works now. Thank you very much. I will give you a beer.

All 3 comments

<widget ...>
  <preference name="GOOGLE_MAPS_ANDROID_API_KEY" value="(api key)" />
  <preference name="GOOGLE_MAPS_IOS_API_KEY" value="(api key)" />
</widget>

Don't include the ( and ) with the keys.

I can't believe it. I spent hours on this. I tried everything. But I always set the key within the "()". I feel so stupid right now. It works now. Thank you very much. I will give you a beer.

I can't believe it. I spent hours on this. I tried everything. But I always set the key within the "()". I feel so stupid right now. It works now. Thank you very much. I will give you a beer.

No worries. We all do that sometimes :)

Was this page helpful?
0 / 5 - 0 ratings