Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

mapbox crash #15394

Closed
gqb opened this issue Aug 16, 2019 · 7 comments
Closed

mapbox crash #15394

gqb opened this issue Aug 16, 2019 · 7 comments

Comments

@gqb
Copy link

gqb commented Aug 16, 2019

2019-08-16 17:33:26.629 4715-4715/? A/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
2019-08-16 17:33:26.630 4715-4715/? A/DEBUG: Build fingerprint: 'google/shamu/shamu:7.1.1/NGI77B/4345728:user/release-keys'
2019-08-16 17:33:26.630 4715-4715/? A/DEBUG: Revision: '0'
2019-08-16 17:33:26.630 4715-4715/? A/DEBUG: ABI: 'arm'
2019-08-16 17:33:26.630 4715-4715/? A/DEBUG: pid: 1929, tid: 1929, name: .opay.pay.alpha >>> team.opay.pay.alpha <<<
2019-08-16 17:33:26.630 4715-4715/? A/DEBUG: signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
2019-08-16 17:33:26.646 4715-4715/? A/DEBUG: Abort message: 'art/runtime/java_vm_ext.cc:470] JNI DETECTED ERROR IN APPLICATION: use of deleted local reference 0x1'
2019-08-16 17:33:26.646 4715-4715/? A/DEBUG: r0 00000000 r1 00000789 r2 00000006 r3 00000008
2019-08-16 17:33:26.646 4715-4715/? A/DEBUG: r4 ac9fd58c r5 00000006 r6 ac9fd534 r7 0000010c
2019-08-16 17:33:26.646 4715-4715/? A/DEBUG: r8 00000000 r9 0000000a sl 00000d42 fp a9d85400
2019-08-16 17:33:26.646 4715-4715/? A/DEBUG: ip 0000000b sp bedd1810 lr aa3945c7 pc aa396e30 cpsr 000e0010
2019-08-16 17:33:27.038 4715-4715/? A/DEBUG: backtrace:
2019-08-16 17:33:27.038 4715-4715/? A/DEBUG: #00 pc 00049e30 /system/lib/libc.so (tgkill+12)
2019-08-16 17:33:27.038 4715-4715/? A/DEBUG: #1 pc 000475c3 /system/lib/libc.so (pthread_kill+34)
2019-08-16 17:33:27.038 4715-4715/? A/DEBUG: #2 pc 0001d635 /system/lib/libc.so (raise+10)
2019-08-16 17:33:27.038 4715-4715/? A/DEBUG: #3 pc 00019181 /system/lib/libc.so (__libc_android_abort+34)
2019-08-16 17:33:27.038 4715-4715/? A/DEBUG: #4 pc 00017048 /system/lib/libc.so (abort+4)
2019-08-16 17:33:27.038 4715-4715/? A/DEBUG: #5 pc 0031b43d /system/lib/libart.so (_ZN3art7Runtime5AbortEPKc+328)
2019-08-16 17:33:27.039 4715-4715/? A/DEBUG: #6 pc 000b526b /system/lib/libart.so (_ZN3art10LogMessageD2Ev+1134)
2019-08-16 17:33:27.039 4715-4715/? A/DEBUG: #7 pc 0023a609 /system/lib/libart.so (ZN3art9JavaVMExt8JniAbortEPKcS2+1584)
2019-08-16 17:33:27.039 4715-4715/? A/DEBUG: #8 pc 0023a8d3 /system/lib/libart.so (_ZN3art9JavaVMExt9JniAbortFEPKcS2_z+66)
2019-08-16 17:33:27.039 4715-4715/? A/DEBUG: #9 pc 00335185 /system/lib/libart.so (_ZNK3art6Thread13DecodeJObjectEP8_jobject+240)
2019-08-16 17:33:27.039 4715-4715/? A/DEBUG: #10 pc 000ca345 /system/lib/libart.so (_ZN3art11ScopedCheck13CheckInstanceERNS_18ScopedObjectAccessENS0_12InstanceKindEP8_jobjectb+120)
2019-08-16 17:33:27.039 4715-4715/? A/DEBUG: #11 pc 000c98ed /system/lib/libart.so (_ZN3art11ScopedCheck22CheckPossibleHeapValueERNS_18ScopedObjectAccessEcNS_12JniValueTypeE+184)
2019-08-16 17:33:27.039 4715-4715/? A/DEBUG: #12 pc 000c8d21 /system/lib/libart.so (_ZN3art11ScopedCheck5CheckERNS_18ScopedObjectAccessEbPKcPNS_12JniValueTypeE+800)
2019-08-16 17:33:27.040 4715-4715/? A/DEBUG: #13 pc 000ccecf /system/lib/libart.so (_ZN3art8CheckJNI13CheckCallArgsERNS_18ScopedObjectAccessERNS_11ScopedCheckEP7_JNIEnvP8_jobjectP7_jclassP10_jmethodIDNS_10InvokeTypeEPKNS_7VarArgsE+110)
2019-08-16 17:33:27.040 4715-4715/? A/DEBUG: #14 pc 000cc501 /system/lib/libart.so (_ZN3art8CheckJNI11CallMethodVEPKcP7_JNIEnvP8_jobjectP7_jclassP10_jmethodIDSt9__va_listNS_9Primitive4TypeENS_10InvokeTypeE+512)
2019-08-16 17:33:27.040 4715-4715/? A/DEBUG: #15 pc 000c1d65 /system/lib/libart.so (_ZN3art8CheckJNI17CallObjectMethodVEP7_JNIEnvP8_jobjectP10_jmethodIDSt9__va_list+40)
2019-08-16 17:33:27.040 4715-4715/? A/DEBUG: #16 pc 00019305 /data/app/team.opay.pay.alpha-1/lib/arm/libmapbox-gl.so
2019-08-16 17:33:27.040 4715-4715/? A/DEBUG: #17 pc 0001918d /data/app/team.opay.pay.alpha-1/lib/arm/libmapbox-gl.so
2019-08-16 17:33:27.040 4715-4715/? A/DEBUG: #18 pc 000195b5 /data/app/team.opay.pay.alpha-1/lib/arm/libmapbox-gl.so
2019-08-16 17:33:27.040 4715-4715/? A/DEBUG: #19 pc 000ff4b9 /data/app/team.opay.pay.alpha-1/lib/arm/libmapbox-gl.so
2019-08-16 17:33:27.040 4715-4715/? A/DEBUG: #20 pc 0002c0d1 /data/app/team.opay.pay.alpha-1/lib/arm/libmapbox-gl.so
2019-08-16 17:33:27.040 4715-4715/? A/DEBUG: #21 pc 0002a9cd /data/app/team.opay.pay.alpha-1/lib/arm/libmapbox-gl.so
2019-08-16 17:33:27.040 4715-4715/? A/DEBUG: #22 pc 00011e73 /system/lib/libutils.so (_ZN7android6Looper9pollInnerEi+614)
2019-08-16 17:33:27.040 4715-4715/? A/DEBUG: #23 pc 00011b7f /system/lib/libutils.so (_ZN7android6Looper8pollOnceEiPiS1_PPv+26)
2019-08-16 17:33:27.041 4715-4715/? A/DEBUG: #24 pc 00093811 /system/lib/libandroid_runtime.so (_ZN7android18NativeMessageQueue8pollOnceEP7_JNIEnvP8_jobjecti+22)
2019-08-16 17:33:27.041 4715-4715/? A/DEBUG: #25 pc 01bb0a55 /system/framework/arm/boot-framework.oat (offset 0x158b000) (android.os.MessageQueue.nativePollOnce+96)
2019-08-16 17:33:27.041 4715-4715/? A/DEBUG: #26 pc 01bb1f69 /system/framework/arm/boot-framework.oat (offset 0x158b000) (android.os.MessageQueue.next+188)
2019-08-16 17:33:27.041 4715-4715/? A/DEBUG: #27 pc 01bad7db /system/framework/arm/boot-framework.oat (offset 0x158b000) (android.os.Looper.loop+366)
2019-08-16 17:33:27.041 4715-4715/? A/DEBUG: #28 pc 016112ff /system/framework/arm/boot-framework.oat (offset 0x158b000) (android.app.ActivityThread.main+426)
2019-08-16 17:33:27.041 4715-4715/? A/DEBUG: #29 pc 000a9941 /system/lib/libart.so (art_quick_invoke_stub_internal+64)
2019-08-16 17:33:27.041 4715-4715/? A/DEBUG: #30 pc 00405d91 /system/lib/libart.so (art_quick_invoke_static_stub+228)
2019-08-16 17:33:27.041 4715-4715/? A/DEBUG: #31 pc 000b0c1b /system/lib/libart.so (_ZN3art9ArtMethod6InvokeEPNS_6ThreadEPjjPNS_6JValueEPKc+178)
2019-08-16 17:33:27.041 4715-4715/? A/DEBUG: #32 pc 00316333 /system/lib/libart.so (_ZN3artL18InvokeWithArgArrayERKNS_33ScopedObjectAccessAlreadyRunnableEPNS_9ArtMethodEPNS_8ArgArrayEPNS_6JValueEPKc+58)
2019-08-16 17:33:27.041 4715-4715/? A/DEBUG: #33 pc 003176a7 /system/lib/libart.so (_ZN3art12InvokeMethodERKNS_33ScopedObjectAccessAlreadyRunnableEP8_jobjectS4_S4_j+766)
2019-08-16 17:33:27.041 4715-4715/? A/DEBUG: #34 pc 002be5f1 /system/lib/libart.so (ZN3artL13Method_invokeEP7_JNIEnvP8_jobjectS3_S3+40)
2019-08-16 17:33:27.041 4715-4715/? A/DEBUG: #35 pc 005adbc9 /system/framework/arm/boot.oat (offset 0x51a000) (java.lang.reflect.Method.invoke+116)
2019-08-16 17:33:27.041 4715-4715/? A/DEBUG: #36 pc 020a04a1 /system/framework/arm/boot-framework.oat (offset 0x158b000) (com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run+100)
2019-08-16 17:33:27.041 4715-4715/? A/DEBUG: #37 pc 020a1327 /system/framework/arm/boot-framework.oat (offset 0x158b000) (com.android.internal.os.ZygoteInit.main+1218)
2019-08-16 17:33:27.041 4715-4715/? A/DEBUG: #38 pc 000a9941 /system/lib/libart.so (art_quick_invoke_stub_internal+64)
2019-08-16 17:33:27.041 4715-4715/? A/DEBUG: #39 pc 00405d91 /system/lib/libart.so (art_quick_invoke_static_stub+228)
2019-08-16 17:33:27.041 4715-4715/? A/DEBUG: #40 pc 000b0c1b /system/lib/libart.so (_ZN3art9ArtMethod6InvokeEPNS_6ThreadEPjjPNS_6JValueEPKc+178)
2019-08-16 17:33:27.041 4715-4715/? A/DEBUG: #41 pc 00316333 /system/lib/libart.so (_ZN3artL18InvokeWithArgArrayERKNS_33ScopedObjectAccessAlreadyRunnableEPNS_9ArtMethodEPNS_8ArgArrayEPNS_6JValueEPKc+58)
2019-08-16 17:33:27.042 4715-4715/? A/DEBUG: #42 pc 00316143 /system/lib/libart.so (_ZN3art17InvokeWithVarArgsERKNS_33ScopedObjectAccessAlreadyRunnableEP8_jobjectP10_jmethodIDSt9__va_list+266)
2019-08-16 17:33:27.042 4715-4715/? A/DEBUG: #43 pc 00278b37 /system/lib/libart.so (_ZN3art3JNI21CallStaticVoidMethodVEP7_JNIEnvP7_jclassP10_jmethodIDSt9__va_list+426)
2019-08-16 17:33:27.042 4715-4715/? A/DEBUG: #44 pc 00067d91 /system/lib/libandroid_runtime.so
2019-08-16 17:33:27.042 4715-4715/? A/DEBUG: #45 pc 0006965f /system/lib/libandroid_runtime.so (_ZN7android14AndroidRuntime5startEPKcRKNS_6VectorINS_7String8EEEb+498)
2019-08-16 17:33:27.042 4715-4715/? A/DEBUG: #46 pc 00001945 /system/bin/app_process32
2019-08-16 17:33:27.042 4715-4715/? A/DEBUG: #47 pc 00016c61 /system/lib/libc.so (__libc_init+48)
2019-08-16 17:33:27.042 4715-4715/? A/DEBUG: #48 pc 00001564 /system/bin/app_process32

Steps to reproduce

random

Expected behavior

no crash

Actual behavior

crashed

Configuration

Android versions:
Device models:

Mapbox SDK versions:
'com.mapbox.mapboxsdk:mapbox-android-sdk:8.1.0'

@LukasPaczos
Copy link
Member

Unfortunately, this is not enough information for us to take any action. Feel free to provide more logs/information and we can reopen. Thank you!

@gqb
Copy link
Author

gqb commented Aug 16, 2019

I found mapbox sdk is not strong, using it is dangerous

@LukasPaczos
Copy link
Member

We're really sad to hear that @gqb. Would you be able to share some use-case and implementation examples? Maybe we can spot setup issues.

@gqb
Copy link
Author

gqb commented Aug 16, 2019

abstract class BusBaseMapFragment : BusBaseFragment() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        Mapbox.getInstance(context!!, BuildConfig.MAP_ACCESS_TOKEN)
    }

    override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
        return inflater.inflate(R.layout.bus_fragment_map, container, false)
    }

    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        mapView.onCreate(savedInstanceState)
        getMapAsync()
    }

    private fun getMapAsync() {
        mapView?.getMapAsync {
            if (isAdded) {
                onGetMap(it)
            }
        }
    }

    abstract fun onGetMap(map: Any)

    override fun onStart() = super.onStart().also {
        mapView?.onStart()
    }

    override fun onResume() = super.onResume().also {
        mapView?.onResume()
    }

    override fun onPause() = super.onPause().also {
        mapView?.onPause()
    }

    override fun onStop() = super.onStop().also {
        mapView?.onStop()
    }

    override fun onSaveInstanceState(outState: Bundle) = super.onSaveInstanceState(outState).also {
        mapView?.onSaveInstanceState(outState)
    }

    override fun onLowMemory() = super.onLowMemory().also {
        mapView?.onLowMemory()
    }

    override fun onDestroyView() = super.onDestroyView().also {
        mapView?.onDestroy()
    }
}
class BusBusinessMapFragment : BusBaseMapFragment() {

    private val locationViewModel by lazy {
        ViewModelProviders.of(this, viewModelFactory).get(BusLocationViewModel::class.java)
    }
    private val mapViewModel by lazy {
        ViewModelProviders.of(activity!!).get(BusMapViewModel::class.java)
    }
    private val stationIconSize by lazy {
        resources.getDimension(R.dimen.bus_margin_8).toInt()
    }
    private val stationTextColor by lazy {
        val color = ContextCompat.getColor(context!!, R.color.bus_green)
        ColorUtils.colorToRgbaString(color)
    }
    private lateinit var symbolManager: SymbolManager
    private var currentLocationSymbol: Symbol? = null
    private var firstStationSymbol: Symbol? = null
    private val middleStationSymbols by lazy { ArrayList<Symbol>() }
    private var lastStationSymbol: Symbol? = null
    private var originSymbol: Symbol? = null
    private var destinationSymbol: Symbol? = null

    private lateinit var lineManager: LineManager
    private val stationsLines by lazy { ArrayList<Line>() }
    var mapLoaded = false
        private set

    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)
        bindActionObserver()
    }

    override fun onGetMap(map: Any) {
        map as MapboxMap
        map.setStyle(Style.MAPBOX_STREETS) {
            mapLoaded = true
            if (isAdded) {
                onSetupStyle(map, it)
            }
        }
    }

    private fun onSetupStyle(map: Any, style: Any) {
        map as MapboxMap
        style as Style
        locationViewModel.startObserveLocation()
        addSymbolLayer(style)
        symbolManager = SymbolManager(mapView, map, style)
        lineManager = LineManager(mapView, map, style, LAYER_SYMBOL_ID)
        addCustomImages(style)
        setupMapProperties(map)
        bindLocationObserver(map)
        mapViewModel.onMapReady(map)
    }

    private fun bindLocationObserver(map: Any) {
        map as MapboxMap
        locationViewModel.onGetLocationEvent.observe(this, Observer {
            showCurrentLocation(map, LatLng(it.latitude, it.longitude))
        })
    }

    private fun bindActionObserver() {
        mapViewModel.moveToLocationEvent.observe(this, Observer {
            moveToLocation(it.first, it.second)
        })
        mapViewModel.changeBottomPaddingEvent.observe(this, Observer {
            setBottomPadding(it.first, it.second)
        })
        mapViewModel.showFirstStationEvent.observe(this, Observer {
            showFirstStation(it.first, it.second)
        })
        mapViewModel.showMiddleStationEvent.observe(this, Observer {
            showMiddleStations(it.first, it.second)
        })
        mapViewModel.showLastStationEvent.observe(this, Observer {
            showLastStation(it.first, it.second)
        })
        mapViewModel.showOriginEvent.observe(this, Observer {
            showOrigin(it.first, it.second)
        })
        mapViewModel.showDestinationEvent.observe(this, Observer {
            showDestination(it.first, it.second)
        })
        mapViewModel.zoomToShowAllMarkersEvent.observe(this, Observer {
            zoomToShowAllMarkers(it.first)
        })
        mapViewModel.drawBusLineEvent.observe(this, Observer {
            drawLine(it.first, it.second.first, it.second.second)
        })
        mapViewModel.clearMapEvent.observe(this, Observer {
            clearMap()
        })
    }

    private fun moveToLocation(map: Any, position: Any) {
        map as MapboxMap
        position as LatLng
        map.cameraPosition = CameraPosition.Builder()
                .target(position)
                .zoom(DEFAULT_ZOOM_LEVEL)
                .build()
    }

    private fun addCustomImages(style: Any) {
        style as Style
        val context = context ?: return
        style.addImage(ICON_ORIGIN,
                BitmapUtils.getBitmapFromDrawable(ContextCompat.getDrawable(context, R.drawable.bus_ic_origin))!!,
                false)
        style.addImage(ICON_CURRENT_LOCATION,
                BitmapUtils.getBitmapFromDrawable(ContextCompat.getDrawable(context, R.drawable.bus_ic_current_location))!!,
                false)
        style.addImage(ICON_FIRST_STATION,
                BitmapUtils.getBitmapFromDrawable(ContextCompat.getDrawable(context, R.drawable.bus_ic_first_station))!!,
                false)
        style.addImage(ICON_MIDDLE_STATION,
                BitmapUtils.getBitmapFromDrawable(ContextCompat.getDrawable(context, R.drawable.bus_ic_middle_station))!!,
                false)
        style.addImage(ICON_LAST_STATION,
                BitmapUtils.getBitmapFromDrawable(ContextCompat.getDrawable(context, R.drawable.bus_ic_end_station))!!,
                false)
        style.addImage(ICON_DESTINATION,
                BitmapUtils.getBitmapFromDrawable(ContextCompat.getDrawable(context, R.drawable.bus_ic_destination))!!,
                false)
    }

    private fun addSymbolLayer(style: Any) {
        style as Style
        val symbolSource = GeoJsonSource(SOURCE_ID, "")
        val symbolLayer = SymbolLayer(LAYER_SYMBOL_ID, SOURCE_ID)
        style.addSource(symbolSource)
        style.addLayer(symbolLayer)
    }

    private fun setupMapProperties(map: Any) {
        map as MapboxMap
        map.uiSettings.apply {
            isCompassEnabled = false
            isRotateGesturesEnabled = false
        }
    }

    private fun showCurrentLocation(map: Any, location: Any) {
        map as MapboxMap
        location as LatLng
        currentLocationSymbol?.apply {
            latLng = location
            symbolManager.update(this)
            return
        }
        val symbolOptions = SymbolOptions().apply {
            withLatLng(location)
            withIconImage(ICON_CURRENT_LOCATION)
        }
        currentLocationSymbol = symbolManager.create(symbolOptions)
    }

    private fun showFirstStation(map: Any, station: BusLineStation) {
        map as MapboxMap
        val location = LatLng(station.stationLat ?: 0.0, station.stationLng ?: 0.0)
        firstStationSymbol?.apply {
            latLng = location
            symbolManager.update(this)
            return
        }
        val symbolOptions = SymbolOptions().apply {
            withLatLng(location)
            withIconImage(ICON_FIRST_STATION)
            withIconSize(0.4f)
            withTextField(station.stationName ?: "")
            withTextColor(stationTextColor)
            withTextOffset(arrayOf(0f, 1.2f))
            withTextSize(14f)
            withTextHaloBlur(0.5f)
            withTextHaloWidth(2f)
            withTextHaloColor(ColorUtils.colorToRgbaString(Color.WHITE))
        }
        firstStationSymbol = symbolManager.create(symbolOptions)
    }

    private fun showMiddleStations(map: Any, locations: List<BusLineStation>) {
        map as MapboxMap
        for (station in locations) {
            val location = LatLng(station.stationLat ?: 0.0, station.stationLng ?: 0.0)
            val symbolOptions = SymbolOptions().apply {
                withLatLng(location)
                withIconImage(ICON_MIDDLE_STATION)
                withIconSize(0.4f)
                withTextField(station.stationName ?: "")
                withTextColor(stationTextColor)
                withTextOffset(arrayOf(0f, 1.2f))
                withTextSize(14f)
                withTextHaloBlur(0.5f)
                withTextHaloWidth(2f)
                withTextHaloColor(ColorUtils.colorToRgbaString(Color.WHITE))
            }
            middleStationSymbols.add(symbolManager.create(symbolOptions))
        }
    }

    private fun showLastStation(map: Any, station: BusLineStation) {
        map as MapboxMap
        val location = LatLng(station.stationLat ?: 0.0, station.stationLng ?: 0.0)
        lastStationSymbol?.apply {
            latLng = location
            symbolManager.update(this)
            return
        }
        val symbolOptions = SymbolOptions().apply {
            withLatLng(location)
            withIconImage(ICON_LAST_STATION)
            withIconSize(0.4f)
            withTextField(station.stationName)
            withTextColor(stationTextColor)
            withTextOffset(arrayOf(0f, 1.2f))
            withTextSize(14f)
            withTextHaloBlur(0.5f)
            withTextHaloWidth(2f)
            withTextHaloColor(ColorUtils.colorToRgbaString(Color.WHITE))
        }
        lastStationSymbol = symbolManager.create(symbolOptions)
    }

    private fun showOrigin(map: Any, location: Any) {
        map as MapboxMap
        location as LatLng
        originSymbol?.apply {
            latLng = location
            return
        }
        val symbolOptions = SymbolOptions().apply {
            withLatLng(location)
            withIconImage(ICON_ORIGIN)
            withIconOffset(arrayOf(0f, -13.5f))
        }
        originSymbol = symbolManager.create(symbolOptions)
    }

    private fun showDestination(map: Any, location: Any) {
        map as MapboxMap
        location as LatLng
        destinationSymbol?.apply {
            latLng = location
            return
        }
        val symbolOptions = SymbolOptions().apply {
            withLatLng(location)
            withIconImage(ICON_DESTINATION)
            withIconOffset(arrayOf(0f, -13.5f))
        }
        destinationSymbol = symbolManager.create(symbolOptions)
    }

    private fun zoomToShowAllMarkers(map: Any) {
        map as MapboxMap
        val markersLatLngs = ArrayList<LatLng>()
        currentLocationSymbol?.let {
            markersLatLngs.add(it.latLng)
        }
        firstStationSymbol?.let {
            markersLatLngs.add(it.latLng)
        }
        for (middleStationPosition in middleStationSymbols) {
            markersLatLngs.add(middleStationPosition.latLng)
        }
        lastStationSymbol?.let {
            markersLatLngs.add(it.latLng)
        }
        originSymbol?.let {
            markersLatLngs.add(it.latLng)
        }
        destinationSymbol?.let {
            markersLatLngs.add(it.latLng)
        }

        if (markersLatLngs.size == 1) {
            map.moveCamera(CameraUpdateFactory.newLatLng(markersLatLngs[0]))
            return
        }

        if (markersLatLngs.size < 3) {
            return
        }

        LatLngBounds.Builder().includes(markersLatLngs).build().let {
            val padding = map.padding
            map.animateCamera(CameraUpdateFactory.newLatLngBounds(it, padding[0], padding[1], padding[2], padding[3] / 2))
        }
    }

    private fun setBottomPadding(map: Any, padding: Int) {
        map as MapboxMap
        map.setPadding(DEFAULT_PADDING, DEFAULT_PADDING, DEFAULT_PADDING, padding)
        zoomToShowAllMarkers(map)
    }

    private fun drawLine(map: Any, locations: List<LatLng>, @ColorRes lineColor: Int) {
        map as MapboxMap
        val lineOptions = LineOptions().apply {
            withLatLngs(locations)
            withLineWidth(stationIconSize / 6f)
            val color = ContextCompat.getColor(context!!, lineColor)
            withLineColor(ColorUtils.colorToRgbaString(color))
        }
        stationsLines.add(lineManager.create(lineOptions))
    }

    private fun clearMap() {
        originSymbol?.let {
            symbolManager.delete(it)
            originSymbol = null
        }
        firstStationSymbol?.let {
            symbolManager.delete(it)
            firstStationSymbol = null
        }
        middleStationSymbols.forEach {
            symbolManager.delete(it)
        }
        middleStationSymbols.clear()
        lastStationSymbol?.let {
            symbolManager.delete(it)
            lastStationSymbol = null
        }
        destinationSymbol?.let {
            symbolManager.delete(it)
            destinationSymbol = null
        }
        stationsLines.forEach {
            lineManager.delete(it)
        }
        stationsLines.clear()
    }

    companion object {
        private const val DEFAULT_ZOOM_LEVEL = 13.0
        private const val DEFAULT_PADDING = 50
        private const val ICON_ORIGIN = "origin"
        private const val ICON_CURRENT_LOCATION = "current_location"
        private const val ICON_FIRST_STATION = "first_station"
        private const val ICON_MIDDLE_STATION = "middle_station"
        private const val ICON_LAST_STATION = "last_station"
        private const val ICON_DESTINATION = "destination"

        private const val SOURCE_ID = "bus_source_id"
        private const val LAYER_SYMBOL_ID = "bus_layer_symbol_id"
    }
}

@gqb
Copy link
Author

gqb commented Aug 16, 2019

@LukasPaczos please help me to check is this correct, thanks

@gqb
Copy link
Author

gqb commented Aug 16, 2019

--------- beginning of crash
2019-08-16 20:01:29.961 20235-20235/team.opay.pay.alpha A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0x1f in tid 20235 (.opay.pay.alpha), pid 20235 (.opay.pay.alpha)
2019-08-16 20:01:30.051 20575-20575/? W/crash_dump32: type=1400 audit(0.0:25679): avc: denied { search } for name="team.opay.pay.alpha" dev="dm-2" ino=8190 scontext=u:r:crash_dump:s0:c512,c768 tcontext=u:object_r:app_data_file:s0:c512,c768 tclass=dir permissive=0
2019-08-16 20:01:30.110 20575-20575/? I/crash_dump32: obtaining output fd from tombstoned, type: kDebuggerdTombstone
2019-08-16 20:01:30.111 505-505/? I//system/bin/tombstoned: received crash request for pid 20235
2019-08-16 20:01:30.114 20575-20575/? I/crash_dump32: performing dump of process 20235 (target tid = 20235)
2019-08-16 20:01:30.114 20235-20235/team.opay.pay.alpha I/libc: orig_dumpable: 1
2019-08-16 20:01:30.115 20575-20575/? A/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
2019-08-16 20:01:30.115 20575-20575/? A/DEBUG: Build fingerprint: 'TECNO/H393/TECNO-LA7:8.1.0/O11019/A-190109V192:user/release-keys'
2019-08-16 20:01:30.115 20575-20575/? A/DEBUG: Revision: '0'
2019-08-16 20:01:30.115 20575-20575/? A/DEBUG: ABI: 'arm'
2019-08-16 20:01:30.115 20575-20575/? A/DEBUG: pid: 20235, tid: 20235, name: .opay.pay.alpha >>> team.opay.pay.alpha <<<
2019-08-16 20:01:30.115 20575-20575/? A/DEBUG: signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x1f
2019-08-16 20:01:30.115 20575-20575/? A/DEBUG: Cause: null pointer dereference
2019-08-16 20:01:30.115 20575-20575/? A/DEBUG: r0 be9057d8 r1 ffffffff r2 00000003 r3 845580d9
2019-08-16 20:01:30.116 20575-20575/? A/DEBUG: r4 be905780 r5 be9057d8 r6 a766b1b8 r7 be905720
2019-08-16 20:01:30.116 20575-20575/? A/DEBUG: r8 00000000 r9 00000000 sl 00000001 fp 00000000
2019-08-16 20:01:30.116 20575-20575/? A/DEBUG: ip 7a470fb0 sp be905720 lr 8456136f pc 845614e2 cpsr 800e0030
2019-08-16 20:01:30.111 20575-20575/? W/crash_dump32: type=1400 audit(0.0:25680): avc: denied { search } for name="team.opay.pay.alpha" dev="dm-2" ino=8190 scontext=u:r:crash_dump:s0:c512,c768 tcontext=u:object_r:app_data_file:s0:c512,c768 tclass=dir permissive=0
2019-08-16 20:01:30.119 353-353/? W/IMGMemtrackHAL: hal_get_memory: memtrack cache rebuild was required
2019-08-16 20:01:30.121 20575-20575/? A/DEBUG: backtrace:
2019-08-16 20:01:30.121 20575-20575/? A/DEBUG: #00 pc 002604e2 /data/app/team.opay.pay.alpha-4PHmYX-asMq3QUVv1SJH2Q==/lib/arm/libmapbox-gl.so
2019-08-16 20:01:30.121 20575-20575/? A/DEBUG: #1 pc 0026036b /data/app/team.opay.pay.alpha-4PHmYX-asMq3QUVv1SJH2Q==/lib/arm/libmapbox-gl.so
2019-08-16 20:01:30.122 20575-20575/? A/DEBUG: #2 pc 00257239 /data/app/team.opay.pay.alpha-4PHmYX-asMq3QUVv1SJH2Q==/lib/arm/libmapbox-gl.so
2019-08-16 20:01:30.122 20575-20575/? A/DEBUG: #3 pc 002571e7 /data/app/team.opay.pay.alpha-4PHmYX-asMq3QUVv1SJH2Q==/lib/arm/libmapbox-gl.so
2019-08-16 20:01:30.122 20575-20575/? A/DEBUG: #4 pc 0018bee4 /data/data/team.opay.pay.alpha/libperfa_arm.so
2019-08-16 20:01:30.122 20575-20575/? A/DEBUG: #5 pc 0018c808 /data/data/team.opay.pay.alpha/libperfa_arm.so
2019-08-16 20:01:30.127 359-373/? I/libPerfService: 15: legacy set freq: -1 -1
2019-08-16 20:01:30.177 368-884/? I/BufferQueueProducer: StatusBar#0 queueBuffer: fps=1.00 dur=1995.65 max=999.44 min=996.21
2019-08-16 20:01:30.183 368-368/? I/DisplayDevice: [Built-in Screen (type:0)] fps:18.409208,dur:1358.02,max:712.37,min:15.79
2019-08-16 20:01:30.276 359-373/? I/libPerfService: 15: legacy set freq: 1274000 -1

@LukasPaczos
Copy link
Member

At first glance, I'm not seeing any major issues with the setup. Those classes have a lot of external dependencies though, so it's hard to judge without a full picture. Could you provide a minimal, standalone project that reproduces the issues?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants