javaandroiddialogmapboxmapview

Android Studio Application Crashing on touching MapView


I'm getting this strange error when I touch, scroll, or interact with the Mapbox Mapview. I don't really understand the error message, I appreciate if anyone could give some insight whats going on I tried everything...

You should know, I'm not calling the mapview in an activity I'm trying to display it in a dialog here's the code:

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);
    }
});

ERROR MESSAGE:

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

Solution

  • Thank you to everyone who answered. I found a solution. Anybody else experiencing this issue you might want to consider downgrading from Android 11 to another version.

    I switched my emulator from Android 11 to Android 9 and it works great!

    source: Android App Keeps Crashing In Android Studio Emulator