android - NativeScript 应用程序在谷歌地图上移动位置时中断
问题描述
我使用 Nativescript 谷歌地图插件在我的移动应用程序中添加了谷歌地图。这是我的html
<MapView #mapView [latitude]="latitude" [longitude]="longitude" [zoom]="zoom" [minZoom]="minZoom" [maxZoom]="maxZoom" [bearing]="bearing" [tilt]="tilt" i-padding="50,50,50,50" [padding]="padding" (mapReady)="onMapReady($event)" (markerInfoWindowTapped)="onMarkerWindowTapped($event)" (cameraChanged)="onCameraChanged($event)" row="1" col="0" colspan="2"> </MapView>
我有一个下拉菜单,其中有一个在地图上显示多个标记的下拉菜单。当我更改下拉列表中的值时,我想更改相机位置。这是我处理下拉更改事件的方式
onchange(args: SelectedIndexChangedEventData) {
let event = this.events.filter(event => event._id === this.itemSource.getValue(args.newIndex));
console.dir(event);
//this.latitude = event[0].locationInfo.coordinates[0];
//this.longitude = event[0].locationInfo.coordinates[1];
}
如果我取消注释最后 2 行并且相机位置发生更改,此代码将成功执行。但是,更改相机位置后,我遇到了无法调试的未知异常
System.err: java.lang.reflect.InvocationTargetException System.err: at java.lang.reflect.Method.invoke(Native Method) System.err: at com.tns.NativeScriptUncaughtExceptionHandler.uncaughtException(NativeScriptUncaughtExceptionHandler.java:55) System.err: at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:1068) System.err: at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:1063) System.err: Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.app.PendingIntent.send(android.content.Context, int, android.content.Intent)' on a null object reference System.err: at com.tns.ErrorReport.startPendingErrorActivity(ErrorReport.java:156) System.err: at com.tns.ErrorReport.startActivity(ErrorReport.java:133) System.err: ... 4 more System.err: java.lang.reflect.InvocationTargetException System.err: at java.lang.reflect.Method.invoke(Native Method) System.err: at com.tns.NativeScriptUncaughtExceptionHandler.uncaughtException(NativeScriptUncaughtExceptionHandler.java:55) System.err: at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:1068) System.err: at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:1063) System.err: Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.app.PendingIntent.send(android.content.Context, int, android.content.Intent)' on a null object reference System.err: at com.tns.ErrorReport.startPendingErrorActivity(ErrorReport.java:156) System.err: at com.tns.ErrorReport.startActivity(ErrorReport.java:133) System.err: ... 4 more
有人至少可以提示我可能导致相同的原因吗?请注意,如果我在更改下拉列表时评论更改纬度/经度的行,则一切正常。
解决方案
推荐阅读
- python - MemoryError: Unable to allocate 5.62 GiB for an array with shape (16384, 30720, 3) and data type float32 when training StyleGan2
- c++ - 返回派生类型时出现协变类型错误
- python - ccxt.base.errors.InvalidOrder:币安订单将立即触发
- c++ - C++ 概念 assignable_from 不接受 const&-returning operator=
- c++ - 如何在函数中显示结构数组
- conan - 柯南没有检测到MinGW gcc
- symfony - acs 路由上的 hslavich / OneloginSamlBundle 问题
- c++ - 如何在组合框中列出所有可用的 VCL 样式并在 ComboBoxChange 事件中,在 C++ Builder 中应用该样式?
- node.js - mongoose.Schema.Types.ObjectId 在 console.logged 时给出一个空数组
- python - 如何在 Ansible 中获取深度嵌套的 dict 值