使用googlemaps时,Android和IOS应用程序崩溃

时间:2019-07-16 14:30:16

标签: android ios google-maps ionic-framework crash

导航到地图页面时,Android和IOS应用程序崩溃。但是能够在离子Cordova上运行浏览器-l

来查看地图

cordova插件列表

com.razorpay.cordova 0.16.1 "RazorpayCheckout"
cordova-android-firebase-gradle-release 2.1.0 "cordova-android-firebase-gradle-release"
cordova-android-play-services-gradle-release 2.1.0 "cordova-android-play-services-gradle-release"
cordova-android-support-gradle-release 3.0.1 "cordova-android-support-gradle-release"
cordova-plugin-add-swift-support 2.0.2 "AddSwiftSupport"
cordova-plugin-compat 1.2.0 "Compat"
cordova-plugin-device 1.1.7 "Device"
cordova-plugin-fcm-with-dependecy-updated 2.4.0 "Cordova FCM Push Plugin"
cordova-plugin-file 6.0.2 "File"
cordova-plugin-file-opener2 2.2.1 "File Opener2"
cordova-plugin-file-transfer 1.7.1 "File Transfer"
cordova-plugin-geolocation 2.4.3 "Geolocation"
cordova-plugin-googlemaps 2.6.3-20190614-1928 "cordova-plugin-googlemaps"
cordova-plugin-ionic 5.3.1 "cordova-plugin-ionic"
cordova-plugin-ionic-webview 2.5.1 "cordova-plugin-ionic-webview"
cordova-plugin-nativegeocoder 3.2.2 "NativeGeocoder"
cordova-plugin-network-information 2.0.2 "Network Information"
cordova-plugin-splashscreen 5.0.3 "Splashscreen"
cordova-plugin-whitelist 1.3.4 "Whitelist"
ionic-plugin-keyboard 2.2.1 "Keyboard"

如果您使用@ionic-native/google-maps,请告诉package.json(只有@ionic-native/core@ionic-native/google-maps很好)

@ionic-native/core :  "^4.4.0",
@ionic-native/google-maps : "^4.14.0",

当前行为: -导航到地图页面时,应用程序崩溃了。

预期的行为: -应用程序应显示google map。

1 个答案:

答案 0 :(得分:0)

尝试在config.xml中添加api密钥:

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

我看到您使用的是不稳定版本,请尝试安装2.6.2版本。