Get started
Kotlin SDK
Reference

Troubleshooting

Troubleshooting

The problems developers hit first, each with its fix.

Credential.Secret does not resolve in my app

The secret key is declared on the JVM alone, so an Android or iOS build cannot name it. Keep it on your server, and build the app's client with Credential.Publishable and a session token your server mints. See authentication in the SDK.

On a JVM server, import the factory that builds it:

import com.mountaya.client.Credential
import com.mountaya.client.Mountaya
import com.mountaya.client.invoke

val server = Mountaya(Credential.Secret(System.getenv("MOUNTAYA_SECRET_KEY").orEmpty()))
server.close()

mountaya.admin does not resolve

The admin operations come with mountaya-admin and one import. Add the module to the server's build, then:

import com.mountaya.admin.admin
import com.mountaya.client.Mountaya

suspend fun organizationName(mountaya: Mountaya, organizationId: String): String =
    mountaya.admin.organizations.getOrganization(organizationId).data.name

MapView does not resolve

MapView and every composable of mountaya-elements are Android only. Call them from androidMain, or from an Android app module. On iOS and the JVM, MapEngine holds the map's state for views of your own.

The client throws ConfigurationException as it is built

The key is empty, has the wrong prefix, or holds a character no HTTP header carries, such as the … of a placeholder. Check that BuildConfig.MOUNTAYA_PUBLISHABLE_KEY holds the key your .env names, and rebuild after changing the file.

Search or a Data API call answers 401

The Data API answers a publishable key only beside a live session token, and a token given as a value expires within minutes. Give the client a SessionTokenEngine whose mint asks your server, as keep the token fresh shows.

The map stays empty

The API refused the map's own requests: the key lacks the tiles scope, or the agreement does not cover the Tile API. Watch map.state.value.isAccessRequired, or collect map.events() and log each MapEvent.AccessRefused with its status and address. See hear what the map refuses.

A write answers 401

The token was minted for another use, or is minted without user_id. Mint it on your server with user_id set and surface = RestSchema.SessionSurface.StudioEmbedded, under a key carrying the studio-embedded scope. See act as a member.

A call answers 402

Your organization's agreement does not cover the call, or a payment is due. Code cannot fix it: show the BillingException's message, which names the fact and where it is resolved, and never retry.

A webhook delivery never verifies

constructWebhookEvent needs the body exactly as it arrived. Read it as bytes before any JSON parser touches it, and pass the endpoint's own secret, whsk_ included. See verify a delivery.

Navigation reads no position

DeviceLocationSource reads only under the full location permission. Declare ACCESS_FINE_LOCATION beside ACCESS_COARSE_LOCATION, ask for it in your own flow, then call recheckPermission() from the result.

Navigation says nothing

The device's speech engine did not start, or your sentence function answered null for that instruction. Call voice.prepare() up front, and hand the voice an onError: it hears SpeechException.Kind.EngineUnavailable where the device has no usable engine.

The build refuses compileSdk or minSdk

The modules need compileSdk 37 or higher and minSdk 24 or higher, Kotlin 2.4 and Java 17. Raise the app's build to those floors. See requirements.

Next steps

Last updated