当我触摸、滚动或与Mapbox Mapview交互时,会出现这个奇怪的错误。我真的不明白错误信息,如果有人能告诉我发生了什么,我很感激。我尝试了一切。。。
你应该知道,我不是在一个活动中调用mapview,我试图在对话框中显示它,这是代码:
newReservation.setPickup_date(datePicker.getYear() + "/" + (datePicker.getMonth()+1) + "/" + datePicker.getDayOfMonth() + " " + timePicker.getHour() + ":" + timePicker.getMinute());
dialog.setContentView(R.layout.enddatedialog);
dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
DatePicker datePicker;
TimePicker timePicker;
ImageView imageViewClose = dialog.findViewById(R.id.dialogClose);
Button continueBtn = dialog.findViewById(R.id.dialogContinueBtn);
datePicker = dialog.findViewById(R.id.dialogEndDate);
timePicker = dialog.findViewById(R.id.dialogEndTime);
imageViewClose.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dialog.dismiss();
}
});
continueBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dialog.dismiss();
newReservation.setDropoff_date(datePicker.getYear() + "/" + (datePicker.getMonth()+1) + "/" + datePicker.getDayOfMonth() + " " + timePicker.getHour() + ":" + timePicker.getMinute());
dialog.setContentView(R.layout.startlocationdialog);
dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
mapView = dialog.findViewById(R.id.dialogMap);
}
});
错误消息:
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.project, PID: 4209
java.lang.SecurityException: getDataNetworkTypeForSubscriber
at android.os.Parcel.createExceptionOrNull(Parcel.java:2373)
at android.os.Parcel.createException(Parcel.java:2357)
at android.os.Parcel.readException(Parcel.java:2340)
at android.os.Parcel.readException(Parcel.java:2282)
at com.android.internal.telephony.ITelephony$Stub$Proxy.getNetworkTypeForSubscriber(ITelephony.java:8762)
at android.telephony.TelephonyManager.getNetworkType(TelephonyManager.java:3021)
at android.telephony.TelephonyManager.getNetworkType(TelephonyManager.java:2985)
at com.mapbox.android.telemetry.TelemetryUtils.obtainCellularNetworkType(TelemetryUtils.java:148)
at com.mapbox.android.telemetry.MapClickEvent.<init>(MapClickEvent.java:45)
at com.mapbox.android.telemetry.MapEventFactory.buildMapClickEvent(MapEventFactory.java:65)
at com.mapbox.android.telemetry.MapEventFactory.access$000(MapEventFactory.java:15)
at com.mapbox.android.telemetry.MapEventFactory$2$1.build(MapEventFactory.java:36)
at com.mapbox.android.telemetry.MapEventFactory.createMapGestureEvent(MapEventFactory.java:61)
at com.mapbox.mapboxsdk.maps.MapGestureDetector.sendTelemetryEvent(MapGestureDetector.java:893)
at com.mapbox.mapboxsdk.maps.MapGestureDetector.access$700(MapGestureDetector.java:42)
at com.mapbox.mapboxsdk.maps.MapGestureDetector$MoveGestureListener.onMoveBegin(MapGestureDetector.java:442)
at com.mapbox.android.gestures.MoveGestureDetector.analyzeMovement(MoveGestureDetector.java:154)
at com.mapbox.android.gestures.MultiFingerGesture.analyzeEvent(MultiFingerGesture.java:98)
at com.mapbox.android.gestures.ProgressiveGesture.analyzeEvent(ProgressiveGesture.java:46)
at com.mapbox.android.gestures.MoveGestureDetector.analyzeEvent(MoveGestureDetector.java:135)
at com.mapbox.android.gestures.BaseGesture.analyze(BaseGesture.java:56)
at com.mapbox.android.gestures.BaseGesture.onTouchEvent(BaseGesture.java:34)
at com.mapbox.android.gestures.AndroidGesturesManager.onTouchEvent(AndroidGesturesManager.java:186)
at com.mapbox.mapboxsdk.maps.MapGestureDetector.onTouchEvent(MapGestureDetector.java:216)
at com.mapbox.mapboxsdk.maps.MapView.onTouchEvent(MapView.java:425)
at android.view.View.dispatchTouchEvent(View.java:14309)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3112)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2785)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3118)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2799)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3118)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2799)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3118)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2799)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3118)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2799)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3118)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2799)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3118)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2799)
at com.android.internal.policy.DecorView.superDispatchTouchEvent(DecorView.java:488)
at com.android.internal.policy.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1871)
at android.app.Dialog.dispatchTouchEvent(Dialog.java:859)
at com.android.internal.policy.DecorView.dispatchTouchEvent(DecorView.java:446)
at android.view.View.dispatchPointerEvent(View.java:14568)
at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:6016)
at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:5819)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:5310)
E/AndroidRuntime: at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:5367)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:5333)
at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:5485)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:5341)
at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:5542)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:5314)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:5367)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:5333)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:5341)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:5314)
at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:8080)
at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:8031)
at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:7992)
at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:8203)
at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:220)
at android.view.InputEventReceiver.nativeConsumeBatchedInputEvents(Native Method)
at android.view.InputEventReceiver.consumeBatchedInputEvents(InputEventReceiver.java:200)
at android.view.ViewRootImpl.doConsumeBatchedInput(ViewRootImpl.java:8160)
at android.view.ViewRootImpl$ConsumeBatchedInputRunnable.run(ViewRootImpl.java:8242)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:972)
at android.view.Choreographer.doCallbacks(Choreographer.java:796)
at android.view.Choreographer.doFrame(Choreographer.java:724)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:957)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:223)
at android.app.ActivityThread.main(ActivityThread.java:7656)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
I/Process: Sending signal. PID: 4209 SIG: 9
检查地图框版本,因为https://github.com/mapbox/mapbox-navigation-android/issues/3577声明他们将在下一次发布(2020年9月(中修复它。
否则,您可以尝试在build.gradle
中添加"com.mapbox.mapboxsdk:mapbox-android-telemetry:6.1.0"
作为依赖项
感谢所有回答的人。我找到了一个解决方案。任何其他遇到这个问题的人,你可能想考虑从Android 11降级到另一个版本。
我把我的模拟器从安卓11切换到安卓9,效果很好!
来源:Android应用程序在Android Studio Emulator 中保持崩溃