https://kotlinlang.org
Join Slack
KotlinByteArray to/from NSData in iOS? I have been struggling for hours trying to make my MPP code w...
h

Henrik

almost 6 years ago
KotlinByteArray to/from NSData in iOS? I have been struggling for hours trying to make my MPP code with with iOS regarding to NSData, and no examples I have found seems to work. I have a Kotlin function that takes a ByteArray as input, and another producing a ByteArray as output. This works perfectly in Java, mapping to byte[], but I have no idea how in iOS I can convert it to/from NSData that can be used in Swift. Any ideas?
h
a
  • 2
  • 6
  • 915
I’m getting this error `androidx/compose/compiler/plugins/kotlin/ComposeComponentRegistrar has been ...
c

Charlie Tapping

over 2 years ago
I’m getting this error
androidx/compose/compiler/plugins/kotlin/ComposeComponentRegistrar has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 55.0.
55 Being Java 11 and 61 being 17 (I guess the latest compose was compiled on a machine with 17) Now Gradle is running with Java 18 I’ve set the toolchain to use 18 with:
kotlin {
    jvmToolchain {
        languageVersion.set(JavaLanguageVersion.of(libs.versions.java.compile.version.get().toInt())) //compile = 18
        vendor.set(JvmVendorSpec.ADOPTIUM)
    }
}
I’ve set the kotlin compile tasks to output Java 11 bytecode:
tasks.withType<KotlinCompile>().configureEach {
    compilerOptions {
        jvmTarget.set(JvmTarget.fromTarget(libs.versions.java.bytecode.version.get())) bytecode = 11
    }
}
On AGP I configured the same
compileOptions {
    sourceCompatibility = JavaVersion.toVersion(libs.versions.java.bytecode.version.get().toInt())
    targetCompatibility = JavaVersion.toVersion(libs.versions.java.bytecode.version.get().toInt())
}

kotlinOptions {
    jvmTarget = libs.versions.java.bytecode.version.get()
}
I really don’t understand how I could be running Java 11 runtime, its like kapt is reading the jvmTarget as the runtime rather than the bytecode target?
c
h
  • 2
  • 13
  • 914
It seems to be possible to get the new focus modifiers in an inconsistent state and the app will cra...
v

vide

over 2 years ago
It seems to be possible to get the new focus modifiers in an inconsistent state and the app will crash on next key press:
java.lang.IllegalStateException: Event can't be processed because we do not have an active focus target.
    at androidx.compose.ui.focus.FocusOwnerImpl.dispatchKeyEvent-ZmokQxo(FocusOwnerImpl.kt:171)
EDIT: I have a hypothesis on why this is happening. I think it's a compose bug. Will write explanation in 🧵 EDIT 2: Debugged the root cause and created a minimal repro and recorded a demo of the crash
😁 1
v
  • 1
  • 9
  • 913
Any idea how to retrieve the version defined in build.gradle.kts so that i can use it in my code ?
l

Laurent Laborde

about 3 years ago
Any idea how to retrieve the version defined in build.gradle.kts so that i can use it in my code ?
l
h
y
  • 3
  • 8
  • 913
What logging solution do you use in your iOS/Android projects? I see that the examples use Napier, ...
s

Stefan Oltmann

over 4 years ago
What logging solution do you use in your iOS/Android projects? I see that the examples use Napier, but there is no support for macOS and judging from the old opened issues the project seems currently unmaintained. Kermit looks like a good option, but is only a pre-release. So what do you recommend?
✅ 1
s
m
+3
  • 5
  • 90
  • 912
Does one you already succeed to mock Build.VERSION.SDK_INT ?
a

Anthony f

almost 7 years ago
Does one you already succeed to mock Build.VERSION.SDK_INT ?
a
t
  • 2
  • 5
  • 911
Hey everyone, how can we build native WIndows Apps with the help of Kotlin Multiplatform? I know we ...
s

Shubham Singh

over 2 years ago
Hey everyone, how can we build native WIndows Apps with the help of Kotlin Multiplatform? I know we generally use Compose Desktop for the UI but that is still a JVM application, right? Isn't it different from building native Windows apps? And if it is possible, is there a UI framework for that? I'm expecting to use frameworks like WinUI3 but afaik, it's written in C#
s
j
+2
  • 4
  • 10
  • 909
does Visual Studio Code support Compose `@preview`
k

Koneko Toujou

almost 3 years ago
does Visual Studio Code support Compose
@preview
🚫 3
k
c
  • 2
  • 4
  • 908
Hello, is it possible to use in kotlin addObserver on NSObject? I want to observe the property value...
i

Ivan Ilic

over 6 years ago
Hello, is it possible to use in kotlin addObserver on NSObject? I want to observe the property value of native object without success. I also tried to implement my own NSObject using this swift example as reference https://developer.apple.com/documentation/swift/cocoa_design_patterns/using_key-value_observing_in_swift. Is anyone have more success and want to share with me?
i
l
+3
  • 5
  • 29
  • 907
Is it possible to use non-kmm libraries, like Mockito, for use in `commonTest` ?
a

adjpd

over 3 years ago
Is it possible to use non-kmm libraries, like Mockito, for use in
commonTest
?
a
b
+4
  • 6
  • 20
  • 905
Previous545556Next

kotlinlang

A modern programming language that makes developers happier.

Powered by