For questions related to Kotlin Multiplatform Mobile, also known as KMM. It is an SDK for iOS and Android app development. Not to be confused with Kotlin Multiplatform which is abbreviated as KMP. KMM is an subset of KMP.
Questions tagged [kmm]
118 questions
0
votes
1 answer
Kotlin KMM stop coroutine flow with infinite loop properly
I'm building a KMM app for retrieving news.
My app fetches news every 30 seconds and save it in a local database. User must be logged for use it. When user want to logout i need to stop refreshing news and delete the local database.
How do i stop a…

Borg
- 55
- 8
0
votes
1 answer
SqlDelight ON CONFLICT DO UPDATE throws near "ON": syntax error (code 1 SQLITE_ERROR)
I'm using SqlDelight in a KMM project. I'm having problems when using the INSERT ON CONFLICT DO UPDATE command.
After some investigation, I found that I needed to update my dialect version of SqlDelight to 3.25 which I did and it works fine, except…

Saul
- 91
- 2
- 14
0
votes
1 answer
Unable to inject sqlDelight in Kmm project
I'm working in a small project trying to implement Kmm. The isse I got is with Koin, where I'm not able to inject DatabaseDriverFactory class in Android (where basically I need a Context).
This is my code:
// This code is in "commonMain"
interface…

Nicote Ool
- 121
- 8
0
votes
2 answers
InvalidMutabilityException: mutation attempt of frozen kotlin.native.internal Exception
I'm very new to the Kotlin Multiplatform and Swift language, I have a problem with KMM only the iOS part, I have successfully run this on Android but it fails on IOS due to concurrency issues.
Kotlin code snippet :
@Throws(Exception::class)
…

zzz
- 83
- 1
- 9
0
votes
0 answers
Exception with Kmm and Ktor
I'm trying to create my first KMM project ( using Ktor to get a simple query ). I've managed to run it in Android, but each time I try in iOS i got an exception when i use Ktor.
This is my gradle
"Shared"
plugins {
kotlin("multiplatform")
…

Nicote Ool
- 121
- 8
0
votes
1 answer
KMM-MockK: Cannot mock the expect object class when I write the unit test case
As the title says, currently I'm having issues using mockk when writing unit tests in commonTest in my KMM project.
In my shared module, I created a useCase class that uses the expected object class to do things like read and write files. But when…

onekinn1023
- 33
- 4
0
votes
0 answers
KMM Project obfuscate Kotlin before build framework
With KMM project, I can build compile code into a file aar for obfuscating code.
But I can't find the way to obfuscate code for objective-c after compiled code.
How can I solve it?

Tam Nguyen Huy
- 17
- 6
0
votes
1 answer
Can't fetch saved account from Keychain
I made a simple analog of the account manager for iOS using Apple Keychain:
@Serializable
data class Account(
val name: String,
val password: String,
val accessToken: String,
val refreshToken: String,
)
actual class…

Denis Sologub
- 7,277
- 11
- 56
- 123
0
votes
0 answers
Is it possible to work with Apple Keychain from Kotlin in KMM?
Basically the whole question is in the title: "Is it possible to work with Apple Keychain from Kotlin in KMM?"
I found there is available platform.Security for iosMain module but it contains constants only. There is a nothing like SecItemAdd and so…

Denis Sologub
- 7,277
- 11
- 56
- 123
0
votes
0 answers
how to upload kmm module to git repo?
I am using KMM (Android, IOS)
this is a working fine, the kmm generates the podspec, and Xcode consumes it from the pod profile
#pod 'shared', :path => '../app-android/shared
however, I want such a way to share the kmm module on the git repo so the…

ASA
- 371
- 1
- 3
- 11
0
votes
1 answer
Xcode fails to build KMM project due to shared:linkPodDebugFrameworkIos
I am building a small project with KMM, it builds perfectly fine on android but cannot build it in XCode. Cocoapods was also installed an genereted without any erros.
What I'm using:
macbook air m1
Kotlin 1.6.10,
gradle 7.3.0-alpha03
Ktor…

Piotr Kedra
- 25
- 9
0
votes
0 answers
How to use Kodein in KMM?
I have this initializer of Kodein in commonMain module:
@ThreadLocal
object CommonInjector {
val kodeinContainer = DI.lazy {
importAll(mainModule)
}
val mainModule = DI.Module("main") {
bind()…

Denis Sologub
- 7,277
- 11
- 56
- 123
0
votes
1 answer
How to create an instance of a platform specific class in KMM?
For example, I have the next class declarations:
// commonMain
expect class MyUseCase {
operator fun invoke()
}
// androidMain
actual class MyUseCase {
actual operator fun invoke() {}
}
// iosMain
actual class MyUseCase {
actual…

Denis Sologub
- 7,277
- 11
- 56
- 123
0
votes
1 answer
kotlin mobile platforms Task 'Debug' not found in project ':shared'
I am trying to add kmm shared module to my ios/android app
however, I got this message from Xcode run
Showing Recent Messages
A problem occurred configuring project ':shared'.
> Could not identify build type for Kotlin framework 'shared' built via…

ASA
- 371
- 1
- 3
- 11
0
votes
1 answer
Kotlin Multipplatform - can't see Greeting.kt in Android Studio folder tree
I am just starting to learn KMM (I'm an Android java guy right now) and going through the default Greeting version of Hello World that is automatically put into a new application. My environment seems to be working as I was able to run the default…

AndyMo
- 21
- 6