yandex/mapkit-android-demo

Краш при вызове invalidate() с использованием GEO_JSON tile format

Elgreed opened this issue · 1 comments

Пытаюсь создать слой c GeoJsonTileProvider. Происходит краш. Версия map kit: 4.5.1-full
Fatal signal 6 (SIGABRT), code -6 (SI_TKILL) in tid 17034 (YMK_6#BgHigh), pid 16563 (arking.app.test) 2024-03-04 14:50:21.470 3657-3722 RequestManager_FLP com.sec.location.nsflp2 E [LocationManager] Location request 193DD766(Listener) gps interval=100ms (min=100ms) from com.google.android.gms.persistent[WorkSource ru.mosparking.app.test(10710)] (10226_FINE_fg_true_foreground) 2024-03-04 14:50:21.473 17193-17193 crash_dump64 pid-17193 A crash_dump.cpp:554] failed to attach to thread 17034, already traced by 17190 (ru.mosparking.app.test)

Создание слоя:
`
val layerOptions = LayerOptions()
layerOptions.cacheable = true

    map()?.let {
        geoJsonTileProvider?.let { tileProvider ->
            layer = it.addLayer(
                MAP_ITEM_LAYER_NAME,
                TileFormat.GEO_JSON,
                layerOptions,
                tileProvider,
                urlProvider,
                projection
            )
        }

        val version = quadKeyRepository.version()
        layer?.dataSourceLayer()?.invalidate(version)
        isGeoJsonWasAddedOnMap = true
    }

`

Получение файла:
private fun generateGeoJsonFeature(): ByteArray { val builder = StringBuilder() val resourceIdentifier: Int = context.resources.getIdentifier("geo_json_example", "raw", context.packageName) val is: InputStream = context.resources.openRawResource(resourceIdentifier) val reader = BufferedReader(InputStreamReader(is`))

    try {
        var line: String?
        while (reader.readLine().also { line = it } != null) {
            builder.append(line)
        }
    } catch (ex: Exception) {
        reader.close()
        Log.d("GeoJsonTileProvider", "Cannot read GeoJSON file")
        throw ex
    }

    return builder.toString().toByteArray()
}`

Метод load в TileProvider:
override fun load(tileId: TileId, version: Version, features: MutableMap<String, String>, etag: String): RawTile { var rawTile = RawTile(version, features, etag, RawTile.UseCache.YES ,RawTile.State.OK, generateGeoJsonFeature()) return rawTile }

Начиная с MapKit SDK 4.4.0 из API была удалена поддержка GeoJson-слоев.
Информация об этом есть на странице со списком изменений.