简体   繁体   中英

Cordova-plugin-googlemaps blank screen on Play store

My Ionic app is using the cordova-plugin-googlemaps 1.3.9 plugin, and everything had been working on iOS and Android until yesterday.

Cordova android : 5.1.1

Cordova iOS : 4.1.1

Cordova CLI : 6.2.0

Ionic Framework Version : 1.2.1-nightly-1867

Ionic CLI Version : 2.0.0

Yesterday, I pushed a new version on the stores and now I've got a blank screen instead of the Google map. The map works on debug mode on my Android phone but not in production mode, I mean from the Play store.

Further to several researches, I have deduced that the problem came from Google Maps Android API v2 key. Thus, I have generated a new key and reinstalled the cordova plugin with the same command but with the new key :

ionic plugin add cordova-plugin-googlemaps --variable API_KEY_FOR_ANDROID="MY_NEW_API_KEY" --variable API_KEY_FOR_IOS="myIosKey"

After that, the map was not working even on debug mode… Therefore, I added the fingerprint of the debug.keystore in the Google Developer console. After this the map started to work again on debug mode

I did the same operation for the production version, using the fingerprint of the release keystore , used to build the production APK.

Despite this, I still have a blank screen instead of the map, when I download the app from the Play store.

I found the solution.

To build my production APK I use Ionic CLI .

I don't know why but the command did not add the cordova-plugin-googlemaps plugin to the signed APK. To solve that, I installed the plugin with the --save option :

cordova plugin add https://github.com/mapsplugin/cordova-plugin-googlemaps --variable API_KEY_FOR_ANDROID="MY_ANDROID_KEY" --variable API_KEY_FOR_IOS="MY_IOS_KEY" --save

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM