Questions tagged [kotlin-multiplatform]
Refers to Kotlin Multiplatform projects, aimed to share codebase between JVM, JS, Android, and Native
863
questions
2
votes
1
answer
39
views
Kotlin Multiplatform : add a Kotlin/Native as common code
I want to create a Kotlin project compatible with Android and Desktop. This project needs to bind to a C library.
The way I understand it, I should create a Kotlin multiplatform project, and have a ...
0
votes
1
answer
26
views
Kotlin multi platform flow block convert to custom wrapper flow use for ios
I have a kotlin multi platform project which contains apollo graphql api
in this project i have BaseRepository Class and in this class there is a method to execute query or mutations
suspend fun <D ...
0
votes
0
answers
43
views
Kotlin Multiplatform doesn't see files from another directory
I am struggling with writing tests for both iOS and Android native side in Kotlin Multiplatform (KMP). I created a couple of interfaces in one module (it's called shared) and created another module, ...
0
votes
0
answers
24
views
Creating JS library with kotlin multi platform and use it on angular 2 via npm
I created and simple kotlin multi platform application and i want to use it on angular project via publishing on npm.
Here is my build.gradle.kts file
plugins {
kotlin("multiplatform")
...
0
votes
0
answers
31
views
Kotlin Multiplatform: Can't reference class in commonMain sourceset from another module's androidMain sourceset
I have two multiplatform modules shared and other in a standard multiplatform template project that targets Android and iOS.
shared defines a class in commonMain source set
class SharedGreeting()
...
0
votes
0
answers
17
views
Kotlin multiplatform JS build doesn't run on IE
Kotlin multiplatform uses \u escape sequence in RegEx which makes it impossible to run the app with IE
1
vote
0
answers
36
views
KMM Project: Expected class has no actual declaration in module for JVM
I have a KMM project that is working perfectly except Android Studio gives an error on every expect function/value in my project complaining the actual version of it doesn't exist for JVM.
The A in a ...
0
votes
0
answers
9
views
Read Gradle module metadata to select an artifact with maven
Maven doesn't read Gradle module metadata to select an artifact.
With Kotlin MultiPlatform, for instance okio publishes a bunch of artifacts like
okio-jvm/
okio-linuxx64/
okio-macosarm64/
okio-...
0
votes
0
answers
17
views
Getting build issue while building kotlin code. "Unresolved reference: datetime in kotlin "
The Complete error is
Execution failed for task ':compileKotlinJs'.
Compilation error. See log for more details
Unresolved reference: datetime
this issue is coming when I do "import kotlinx....
0
votes
2
answers
40
views
Kotlin multiplatform publish with dokka and sources
I am struggling to publish a Kotlin multiplatform project properly to maven (for now mavenLocal). I can add the dependency to another multiplatform project and use the code but I don't get any ...
0
votes
0
answers
20
views
Can't build an executable JAR using Compose Multiplatform
How do I create an executable JAR file using Compose Multiplatform? I create a JAR artifact from the jvmMain module, create it and get the following error:
Kotlin: [Internal Error] java.lang....
0
votes
0
answers
32
views
Gradle maven-publish / Sonatype creates multiple repositories that can't be closed
I'm trying to deploy a library to Maven Central (which I have done many times before) but in this case it contains many different publications for different platforms. The upload by the maven-publish ...
0
votes
1
answer
66
views
How to force view updates from changes in value of published array item
Disclaimer: Android developer here
Been trying to make an existing android app work on iOS via KMM and I'd like to know if there's a way to force a view update in SwiftUI when only an update is made ...
0
votes
1
answer
34
views
Android Studio isn't indexing commonMain folder after adding any dependencies to its sourceSet
I'm trying to create module with shared code for Android and iOS, but when I add any dependency to commonMain it's stopping to index that folder. If I remove dependencies, everything is okay. gradlew ...
1
vote
2
answers
68
views
Using flutter module in kotlin multiplatform app
I created an application with kotlin multiplatform and I want now to use flutter to develop the UI once. I followed the tutorial to integrate flutter in an already existing Android app and I choose ...
0
votes
1
answer
49
views
Can you work with Kotlin Multiplatform Mobile (KMM) using Windows for Android part?
I wanted to enable one of my Android project to the new KMM but will deploy only for Android platform for the time being. According to this FAQ page it seems that the plugin works only for macOS. But ...
0
votes
1
answer
77
views
Adding kotlinx-datetime to my Kotlin Multiplatform app breaks iOS build
I was able to successfully run the sample app generated by Android Studio in both Android and iOS. I chose CocoaPods during the Wizard steps.
But when I add kotlinx-datetime to my dependencies, I can ...
0
votes
0
answers
98
views
Building Kotlin Multiplatform app with Xcode Cloud
as Apple announced that Xcode Cloud is now available for all developers, I tried to set it up for a Kotlin Multiplatform project. The start was a little bit hard tbh. Currently I am facing following ...
1
vote
1
answer
48
views
Use enforcePlatform in Kotlin multiplatform [duplicate]
How can I use enforcePlatform function in Kotlin multiplatform?
This works well:
plugins {
kotlin("js")
}
dependencies {
fun kotlinw(target: String): String =
"org....
0
votes
0
answers
19
views
Access all loaded Modules
I have a Kotlin multiplatform project aiming to serialize/deserialize and exchange some objects between jvm and browser target applications. Because Kotlin/js has no full reflective support, the full ...
0
votes
1
answer
48
views
Recompose text after value has been changed
First I want to mention that this is Compose Desktop Application and not Android.
I have LogManager class which will be responsible for handling logs:
class LogManager {
var log = mutableStateOf(&...
0
votes
0
answers
37
views
get declared fields in kotlin multiplatform
is there a way, to dynamically get reference to object field in kotlin multiplatform? I am trying to dynamically create instances of generic object from json input, in which I need to define exact ...
0
votes
1
answer
47
views
Is the a way to reuse an existing Android ViewModel for iOS with KMM
I'm trying to convert an existing Android project to Kotlin Multiplatform Mobile (KMM).
A bunch of the app logic is contained in the viewmodel and I would really love to share said logic with the iOS ...
1
vote
0
answers
115
views
Unresolved reference iosMain Kotlin Multiplatform
I have a Kotlin Multiplatform library that other KMM projects are using. I'm trying to build the iOS app of one of these KMM projects but first I need to publish the library binaries to a Maven repo.
...
3
votes
0
answers
69
views
Why is Koin scoping feature not working properly?
So scoping with Koin DI seem to throw a weird exception when KoinApplication::checkModules() method is called within a unit test. Here is the full code:
import org.koin.core.KoinApplication
import ...
1
vote
1
answer
53
views
Passing Android / iOS specific arguments in Actual / Expect classes in Kotlin Mutliplatform project
So I'm trying to integrate KMM module into an already existing android app. I'm exposing a class from common KMM module into the Android project, which looks something like this (please ignore the ...
0
votes
0
answers
58
views
iOS cocoaods framework not generating in Kotlin Multiplatform project
I am creating KMM library. I want to create a cocoapods framework, but when I tried to build my project, the framework is not generating. I tried clean project and build again. My cocoapods is not ...
0
votes
0
answers
29
views
- ERROR | [OSX] unknown: Encountered an unknown error (Unsupported file type: ) during validation
Hey guys I am using cocoapods in my kotlin multiplatform project. I am trying to do private pod spec from the doc. When I am trying to push the code I am getting weried issue on my terminal
Validating ...
0
votes
0
answers
32
views
Crash when encode mutable map
I got crash when try to encode to string a mutable map
internal class AsyncStorageHolder(
var manifest: MutableMap<String, String> = mutableMapOf(),
var ...
0
votes
0
answers
42
views
How to throw an new exception from client if refresh token is expired: Ktor Client KMM oAuth bearer token
I have the following code to execute an use case from this guys: arkitekt.
Long story short the use case build happends in a KMM shared module.
Inside this use case i make HTTP request with ease.
The ...
0
votes
2
answers
71
views
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 ...
0
votes
0
answers
40
views
Generate different artifactId when publish library in android
Hey I am publish library in kotlin multiplatform. I used this command ./gradlew clean assemble publish my three package is generated. I given the name var libraryArtifactId = "kmm-module" ...
1
vote
0
answers
69
views
Could not create domain object 'gpr' (MavenPublication) in build.gradle.kts
Hey I am trying to publish kmm library in github packages. I followed this doc. But I don't understand
what is project.findProperty("gpr.user") and ("gpr.key")?
I used macos so ...
0
votes
0
answers
75
views
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
&...
0
votes
1
answer
26
views
How to Access existing realmDB of clientApp in KotlinMultiPlatform Module
I'm trying to build common data parsing module in KMM where I need to save the data in the same realm DB which is already present in the client's Android App or iOS app?
I would like to know if this ...
0
votes
2
answers
231
views
How to update latest gradle version of kotlin library
I created a library in multiplatform in latest intellij. My intellj added the outdated gradle version
settings.gradle.kts
pluginManagement {
repositories {
google()
...
0
votes
1
answer
114
views
Kotlin Multiplatform build OUTPUT_SIZE error
I'm having this error happen to me, out of the blue and have no ideia where it came from and why it happened. It' breaking on GitHub CI with the same error message. Any clue about what's happening?
...
0
votes
0
answers
74
views
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?
11
votes
2
answers
287
views
KMM: Compilation failed: Unexpected IrType kind: KIND_NOT_SET
I'm trying to run tests in the shared library.
Setup (versions should be the same for both machines - all are up to date as of today):
Kotlin 1.6.21 (tried 1.6.20 and 1.6.10)
OpenJDK 11.0.15 (via ...
1
vote
2
answers
142
views
How to import Kotlin/JS generated module in a separate npm-based project
I would like to create a js library with Kotlin Multiplatform (an example of which is this project, where we have a webscocket server and a js client) which I will then build as a npm package and ...
1
vote
1
answer
83
views
Azure pipeline fails on building Kotlin Multiplatform shared framework usinig embedAndSignAppleFrameworkForXcode and fastlane
I'm working on a Kotlin Multiplatform project which is building fine locally but I can't get it to work on an Azure DevOps pipeline.
Some good things to know:
not using Cocoapods
using the ...
1
vote
0
answers
43
views
Execution failed for task ':generateMetadataFileForIosArm64Publication'
I am reading this Creating your first Kotlin Multiplatform library. I updated the maven-publish Gradle plugin. After that I run the command ./gradlew publishToMavenLocal.
I am getting error
Execution ...
0
votes
0
answers
47
views
Drawing Graphs with Compose Multiplatform
I wanted to start using Compose Multiplatform and now I need to draw a Graph with it, so something like the following picture, but the style could be different
I mean I could do it with a canvas and ...
1
vote
0
answers
98
views
Project :app declares a dependency from configuration 'implementation' to configuration 'debug' which is not declared in the descriptor for project
I am trying to add a Kotlin Multiplatform Module as part of an Android project I am building. In the library, my top level build.gradle.kts looks like this:
buildscript {
repositories {
...
0
votes
1
answer
40
views
Is there a truly multiplatform testing setup for Jetbrains @Composable functions?
I'd love to be able to get a @Composable context running in the androidTest target of my common project, in order to test higher-order components that reside in commonMain, such as ...
0
votes
0
answers
62
views
How to throw Custom exception in ktor
Hey I am working in ktor. I want to throw exception in ktor. I am reading this doc and this example. I want exception, responseCode and errorResponse with errorCode and errorMessage.
commanMain
...
0
votes
1
answer
60
views
How to use interface in swift with Kotlin multiplatform moblie
I am trying to use interface in swift, but it unable to find the property
commainMain
interface ApplicationToken {
val accessToken: String
val refreshToken: String
}
iosMain
Platform.kt
...
1
vote
1
answer
74
views
How do you make the Enter key move focus in Kotlin Compose Desktop?
I am making a program with a lot of text fields that needs to shift focus once Enter is pressed. They are all set to single line. (It should go to the next text field, once Enter is pressed)
I was ...
0
votes
1
answer
43
views
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
...
1
vote
2
answers
147
views
How to use Log in kotlin multiplatform Moblie
Hey I am working in Ktor. I found this answer to show log in specific platform iOS and Android. But when I am building this through gradle I am getting error on this when running this command on ...