When rapidly switching between my map-fragment and any other fragment "Fatal signal 11 (SIGSEGV)" occurs and the app crashes. I have read that this error is related to a library function issue and I am guessing it has something to do with the function in my onConnected() method, hence the Log message. Any help on how to resolve the issue is appreciated, thank you.
Relevant code:
@SuppressWarnings("MissingPermission")
override fun onStart() {
val settings = context?.getSharedPreferences(preferencesFile, Context.MODE_PRIVATE)
downloadDate = settings?.getString("lD", "").toString()
if (downloadDate != currentDate){
//some stuff that is not being executed, not relevant for the error
}
super.onStart()
if(PermissionsManager.areLocationPermissionsGranted(this.context)){
locationEngine?.requestLocationUpdates()
locationLayerPlugin?.onStart()
}
mapView.onStart()
}
override fun onResume() {
super.onResume()
mapView.onResume()
}
override fun onPause() {
super.onPause()
mapView.onPause()
}
override fun onStop() {
val settings = context?.getSharedPreferences(preferencesFile, Context.MODE_PRIVATE)
val editor = settings?.edit()
editor?.putString("lD", downloadDate)
editor?.apply()
locationEngine?.removeLocationUpdates()
locationLayerPlugin?.onStop()
super.onStop()
mapView.onStop()
}
override fun onLowMemory() {
super.onLowMemory()
mapView.onLowMemory()
}
override fun onDestroy() {
locationEngine?.deactivate()
val settings = context?.getSharedPreferences(preferencesFile, Context.MODE_PRIVATE)
val editor = settings?.edit()
editor?.putString("shil", shilview.text.toString())
editor?.putString("dolr", dolrview.text.toString())
editor?.putString("quid", quidview.text.toString())
editor?.putString("peny", shilview.text.toString())
editor?.apply()
super.onDestroy()
mapView.onDestroy()
}
override fun onDestroyView() {
mapView.onDestroy()
super.onDestroyView()
}
override fun onSaveInstanceState(outState: Bundle) {
super.onSaveInstanceState(outState)
mapView.onSaveInstanceState(outState)
}
@SuppressWarnings("MissingPermission")
override fun onConnected() {
Log.d(t, "[onConnected] requesting location updates")
locationEngine?.requestLocationUpdates()
}
override fun onExplanationNeeded(permissionsToExplain: MutableList<String>?) {
Log.d(t, "Permissions: $permissionsToExplain")
}
override fun onLocationChanged(location: Location?) {
location?.let{
originLocation = location
setCameraPosition(location)
}
}
override fun onPermissionResult(granted: Boolean) {
Log.d(t, "[onPermissionResult] granted == $granted")
if(granted){
enableLocation()
}else{
Toast.makeText(context, "Let me know where you are. Hide and seek is not my game.", Toast.LENGTH_LONG).show()
}
}
override fun onRequestPermissionsResult(requestCode: Int, permissions: Array<out String>, grantResults: IntArray) {
permissionsManager.onRequestPermissionsResult(requestCode, permissions, grantResults)
}
private fun enableLocation(){
if (PermissionsManager.areLocationPermissionsGranted(this.context)){
Log.d(t, "Permissions granted")
initLocationEngine()
initLocationLayer()
}else{
Log.d(t, "Permissions denied")
permissionsManager = PermissionsManager(this)
permissionsManager.requestLocationPermissions(this.activity)
}
}
private fun setCameraPosition(location: Location){
map.animateCamera(CameraUpdateFactory.newLatLng(LatLng(location.latitude, location.longitude)))
}
@SuppressWarnings("MissingPermission")
private fun initLocationEngine(){
locationEngine = LocationEngineProvider(this.context).obtainBestLocationEngineAvailable()
locationEngine?.apply {
interval = 5000
fastestInterval = 1000
priority = LocationEnginePriority.HIGH_ACCURACY
activate()
}
val lastLocation = locationEngine?.lastLocation
if(lastLocation != null){
originLocation = lastLocation
setCameraPosition(lastLocation)
}else{
locationEngine?.addLocationEngineListener(this)
}
}
@SuppressWarnings("MissingPermission")
private fun initLocationLayer(){
locationLayerPlugin = LocationLayerPlugin(mapView, map, locationEngine)
locationLayerPlugin?.apply{
setLocationLayerEnabled(true)
cameraMode = CameraMode.TRACKING
renderMode = RenderMode.NORMAL
}
}
Debugger:
D/FragmentMap: Permissions granted
D/FragmentMap: [onConnected] requesting location updates
V/AudioManager: playSoundEffect effectType: 0
W/libEGL: EGLNativeWindowType 0x711ce13010 disconnect failed
D/CubicBezierInterpolator: CubicBezierInterpolator mControlPoint1x = 0.23, mControlPoint1y = 0.06, mControlPoint2x = 0.09, mControlPoint2y = 0.97
D/CubicBezierInterpolator: CubicBezierInterpolator mControlPoint1x = 0.6, mControlPoint1y = 0.9, mControlPoint2x = 0.8, mControlPoint2y = 1.0
D/CubicBezierInterpolator: CubicBezierInterpolator mControlPoint1x = 0.23, mControlPoint1y = 0.06, mControlPoint2x = 0.09, mControlPoint2y = 0.97
D/CubicBezierInterpolator: CubicBezierInterpolator mControlPoint1x = 0.6, mControlPoint1y = 0.9, mControlPoint2x = 0.8, mControlPoint2y = 1.0
V/AudioManager: playSoundEffect effectType: 0
I/zygote64: Do full code cache collection, code=1007KB, data=661KB
I/zygote64: After code cache collection, code=1003KB, data=590KB
V/Mbgl-ConnectivityReceiver: Connected: true
I/Mbgl-EGLConfigChooser: In emulator: false
D/mali_winsys: EGLint new_window_surface(egl_winsys_display *, void *, EGLSurface, EGLConfig, egl_winsys_surface **, egl_color_buffer_format *, EGLBoolean) returns 0x3000
D/FragmentMap: Permissions granted
D/FragmentMap: [onConnected] requesting location updates
V/AudioManager: playSoundEffect effectType: 0
W/libEGL: EGLNativeWindowType 0x711ce13010 disconnect failed
D/CubicBezierInterpolator: CubicBezierInterpolator mControlPoint1x = 0.23, mControlPoint1y = 0.06, mControlPoint2x = 0.09, mControlPoint2y = 0.97
D/CubicBezierInterpolator: CubicBezierInterpolator mControlPoint1x = 0.6, mControlPoint1y = 0.9, mControlPoint2x = 0.8, mControlPoint2y = 1.0
D/CubicBezierInterpolator: CubicBezierInterpolator mControlPoint1x = 0.23, mControlPoint1y = 0.06, mControlPoint2x = 0.09, mControlPoint2y = 0.97
D/CubicBezierInterpolator: CubicBezierInterpolator mControlPoint1x = 0.6, mControlPoint1y = 0.9, mControlPoint2x = 0.8, mControlPoint2y = 1.0
V/AudioManager: playSoundEffect effectType: 0
V/Mbgl-ConnectivityReceiver: Connected: true
I/Mbgl-EGLConfigChooser: In emulator: false
D/mali_winsys: EGLint new_window_surface(egl_winsys_display *, void *, EGLSurface, EGLConfig, egl_winsys_surface **, egl_color_buffer_format *, EGLBoolean) returns 0x3000
D/FragmentMap: Permissions granted
V/AudioManager: playSoundEffect effectType: 0
I/zygote64: Do partial code cache collection, code=1003KB, data=614KB
I/zygote64: After code cache collection, code=1003KB, data=614KB
I/zygote64: Increasing code cache capacity to 3MB
W/libEGL: EGLNativeWindowType 0x711ce13010 disconnect failed
D/CubicBezierInterpolator: CubicBezierInterpolator mControlPoint1x = 0.23, mControlPoint1y = 0.06, mControlPoint2x = 0.09, mControlPoint2y = 0.97
D/CubicBezierInterpolator: CubicBezierInterpolator mControlPoint1x = 0.6, mControlPoint1y = 0.9, mControlPoint2x = 0.8, mControlPoint2y = 1.0
CubicBezierInterpolator mControlPoint1x = 0.23, mControlPoint1y = 0.06, mControlPoint2x = 0.09, mControlPoint2y = 0.97
D/CubicBezierInterpolator: CubicBezierInterpolator mControlPoint1x = 0.6, mControlPoint1y = 0.9, mControlPoint2x = 0.8, mControlPoint2y = 1.0
D/FragmentMap: [onConnected] requesting location updates
V/AudioManager: playSoundEffect effectType: 0
A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0x30 in tid 7693 (.frederik.coinz)
Disconnected from the target VM, address: 'localhost:8600', transport: 'socket'