cla-bot · GitHub

Root cause
LocationProvider.swift:226 called location.hasMslAltitude(), which transpiles to the Android Location.hasMslAltitude() method. That method (and getMslAltitudeMeters()) was only added in API 33 (Android 13 / TIRAMISU). On older devices the JVM finds no such method and throws NoSuchMethodError, crashing in LocationEvent..

The change
I guarded the MSL altitude access behind a runtime SDK check so it's only invoked on Android 13+:

LocationProvider.swift:226-231
// hasMslAltitude()/getMslAltitudeMeters() were added in API 33 (Android 13); calling them on older devices throws NoSuchMethodError
if android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.TIRAMISU, location.hasMslAltitude() {
self.altitude = location.getMslAltitudeMeters()
} else {
self.altitude = 0.0
}
On devices below API 33, altitude falls back to 0.0 (same fallback the original code used when MSL altitude was unset). The separate ellipsoidalAltitude field on the next line continues to populate from getAltitude(), which is available on all supported API levels.

This is the standard Skip pattern: the version constant resolves to android.os.Build.VERSION_CODES.TIRAMISU in the transpiled Kotlin, and the short-circuit && prevents hasMslAltitude() from ever being referenced on older runtimes.

No other hasMslAltitude/getMslAltitudeMeters usages exist in the source. The crash should be resolved on rebuild.

Read the original on github.com ↗