Closed jkbredsquiggles closed 1 year ago
Answering my own question - I looked at one of the ktor kmm demos and noticed that the memory model needs to be specified in the gradle.properties file, i.e. I added this:
# ios
kotlin.native.binary.memoryModel=experimental
and the problems went away.
As an aside - related to my issues with my initial attempts using the current version - I also noticed that the ktor example at the above link treated the html response as a string instead of using the ContentNegotiation (feature?), e.g.
it used something like
suspend fun getHtml(): String {
val response = client.get("https://ktor.io/docs")
return response.bodyAsText()
}
instead of
suspend fun getAllLaunches(): List<RocketLaunch> {
return httpClient.get("https://api.spacexdata.com/v3/launches").body()
}
I'm hoping the ktor demo works. Treating the body as text and manually applying Json serialization was going to be my next attempt at addressing my issues - if whomever is dealing with this has the time to confirm whether that second issue can be addressed in a similar manner it would be appreciated and it might help make this application work better with the current version of kotlin and ktor.
I'm leaving the issue open, as I think the demo needs to be updated. But I'd also like to assume that I've helped solve it.
This worked for me... thanks..
Answering my own question - I looked at one of the ktor kmm demos and noticed that the memory model needs to be specified in the gradle.properties file, i.e. I added this:
# ios kotlin.native.binary.memoryModel=experimental
and the problems went away.
Thank you for helping! You're a star!
Hi:
First some context.
I tried to run the demo using the current version of Android Studio (2021.2.1 Patch 1 built on May 18, 2022), Kotlin (Android studio won't display the full plugin version but it looks like it was built on Jul 7, 2022 and it's in the 1.7 series) and it's associated libraries ( current versions of the serialization, sql delight, and tor libraries). I had issues running the Android app, an exception trying to deserialize the response from spacex service.
Because I had manually tried to update the project references and this is one of my first hmm projects, I gave up on that experiment and attempted to use the current version of the demo on the bpd-final branch.
The android app works and the iso app crashes with the exception below.
I haven't included references and version detail (other than the Android and Kotlin version above) as I assume that you can find it from the commit. Let me know if you need more information.
[Note that I removed some of the file system path information from the exception in a lame attempt to obfuscate some of the possibly personal data - I hope that doesn't confused the issue]