Setup Android
Use a compatible Kotlin version
Ensure that you are using Kotlin version 1.9.0 or newer. You can check the most recent Kotlin version on kotlinlang.org.
(new) Gradle with a declarative plugins block
Open android/settings.gradle
and set the Kotlin version like this:
android/settings.gradle
plugins {
// ...
id "org.jetbrains.kotlin.android" version "1.9.0" apply false
}
In case you can't find the plugins {}
block your app still uses the old apply
script method.
(old) In a legacy apply script gradle file
Open android/app/build.gradle
and set the Kotlin version like this:
android/app/build.gradle
buildscript {
ext.kotlin_version = '1.9.0'
// ...
}
Set the permissions
If you want to show the user's location on the map you need to add
the permissions in the application
manifestandroid/app/src/main/AndroidManifest.xml
.
android/app/src/main/AndroidManifest.xml
<manifest>
<!-- Always include this permission -->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<!-- Include only if your app benefits from precise location access. -->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
</manifest>
Starting from Android API level 23 you also need to request it at runtime.
You can use the PermissionManager
for it.