Closed NiKoTron closed 1 year ago
@NiKoTron This might be due to a file that was migrated to Kotlin.
Do you happen to have a code snippet that reproduces the error? That would be helpful.
@louwers Yep, I guess it's relates to kotlin to native interportability of floats or smth.
There's a function with minimum reproducible steps
fun minimumReproducibleExample(){
val tiles = arrayOf("https://api.maptiler.com/tiles/satellite-v2/{z}/{x}/{y}@2x.jpg?key=your_key")
val tileSet = TileSet("2.1.0", *tiles)
//set bounds here
val bounds = floatArrayOf(-180.0f, -85.05113f, 180.0f, 85.05113f)
tileSet.setBounds(*bounds) // or like tileSet.setBounds(-180.0f, -85.05113f, 180.0f, 85.05113f) doesn't matter
//trying to create source
RasterSource("source_id", tileSet) // <- Crash here
//java.lang.Error: bounds must be an array with left, bottom, top, and right values
// at com.mapbox.mapboxsdk.style.sources.RasterSource.initialize(Native Method)
// at com.mapbox.mapboxsdk.style.sources.RasterSource.<init>(RasterSource.kt:125)
}
Thanks
The root cause seems to be that Kotlin's FloatArray
is not recognized as an array anymore.
I created a test with a reproduction
https://github.com/louwers/maplibre-gl-native/commit/0d8d4f1bed88d1756dda8c51ab45344b9da1ea82
We can either go back to using Float[]
or adopt the C++ JNI interface so that it can handle FloatArray
. @artakka what do you think is best?
@louwers Will have a look
Describe the bug Got a crash while creating a RasterSource object with TileSet with bounds.
To Reproduce Steps to reproduce the behavior:
java.lang.Error: bounds must be an array with left, bottom, top, and right values
Expected behavior A clear and concise description of what you expected to happen.
Platform information (please complete the following information):
Additional context It reproduced only with android library v10.0.0 There's no exception on earlier versions