James Black
04/07/2022, 3:37 AMkotlin {
android()
iosX64()
iosArm64()
iosSimulatorArm64()
jvm()
Near the end I have this:
val jvmMain by getting {
dependencies {
implementation("io.ktor:ktor-client-apache:${Versions.ktor}")
}
}
}
}
android {
compileSdk = 32
sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml")
defaultConfig {
minSdk = 30
targetSdk = 32
}
}
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
kotlinOptions {
jvmTarget = JavaVersion.VERSION_11.toString()
freeCompilerArgs = listOf("-Xallow-jvm-ir-dependencies", "-Xskip-prerelease-check",
"-Xuse-experimental=kotlinx.coroutines.ExperimentalCoroutinesApi", "-Xjvm-default=all"
)
}
}
It recognizes jvmMain as I had to include the expected functions.
In my server build.gradle I have:
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
kotlin("jvm")
id("kotlin-platform-jvm")
id("war")
id("application")
kotlin("plugin.serialization")
id("kotlinx-serialization")
}
dependencies {
implementation(project(":shared"))
Snipped rest
}
kotlin {
sourceSets.all {
languageSettings {
optIn("kotlin.RequiresOptIn")
}
}
}
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
When I look at anything from the shared project it goes to the androidMain version, not the jvmMain version. How do I get it to find the correct versions of the classes?vishal G
04/07/2022, 9:11 AMGellért Biró
04/07/2022, 11:13 AMIgor Kozlinskyi
04/07/2022, 2:20 PMJeff Tycz
04/08/2022, 1:23 AMiamthevoid
04/08/2022, 7:53 AMLucas Schiavini
04/08/2022, 3:09 PMpguardiola
04/08/2022, 8:14 PMUncaught Kotlin exception: kotlin.IllegalStateException: There is no event loop. Use runBlocking { ... } to start one.
pguardiola
04/08/2022, 8:21 PMCoroutines 1.7.0 will be released withoutcompanion and we are gradually stopping the support ofnative-mt
during the course ofnative-mt
lifecycle. We still are ready to accept PRs or release versions with the new Kotlin if there is a need to, but new coroutine features won't get1.6.x
support.native-mt
Arjan van Wieringen
04/09/2022, 3:35 PMEric Ampire [MOD]
04/09/2022, 7:38 PMhenrikhorbovyi
04/10/2022, 3:17 PMThe operation could''t be completed. Unable to locate a Java Runtime.
Please visit <http://www.java.com> for information on installing Java.
Command PhaseScriptExecution failed with a nonzero exit code
From Android Studio I even can run it on an iOS emulator, but I can’t get preview or run it from xcode.
Anyone to help me on that 😄 ?Francesco Bonnì
04/11/2022, 12:58 PMorg.gradle.internal.resolve.ModuleVersionResolveException: Could not resolve org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.0-native-mt.
We tried to move the strictly on iOSMain and remove it from commonMain, Android run but iOS Crash for runBlocking{} no event loop.
Does someone have an idea how to solve it🙏?
Thank youVivek Modi
04/11/2022, 2:45 PM"io.ktor:ktor-client-core:2.0.0-beta-1"
In android
"io.ktor:ktor-client-android:2.0.0-beta-1"
In Ios
"io.ktor:ktor-client-ios:2.0.0-beta-1"
Do we need to add core, android and ios library in the commonMain, androidMain and iosMain respectively?
sourceSets {
val commonMain by getting
val commonTest by getting {
dependencies {
implementation(kotlin("test"))
}
}
val androidMain by getting
val androidTest by getting
val iosX64Main by getting
val iosArm64Main by getting
val iosSimulatorArm64Main by getting
val iosMain by creating {
dependsOn(commonMain)
iosX64Main.dependsOn(this)
iosArm64Main.dependsOn(this)
iosSimulatorArm64Main.dependsOn(this)
}
val iosX64Test by getting
val iosArm64Test by getting
val iosSimulatorArm64Test by getting
val iosTest by creating {
dependsOn(commonTest)
iosX64Test.dependsOn(this)
iosArm64Test.dependsOn(this)
iosSimulatorArm64Test.dependsOn(this)
}
}
Arjan van Wieringen
04/11/2022, 6:11 PMCaused by: org.gradle.api.GradleException: Cannot find dukat@0.5.8-rc.4 in yarn.lock
at org.jetbrains.kotlin.gradle.targets.js.yarn.YarnEntryRegistry.find(YarnEntryRegistry.kt:37)
at org.jetbrains.kotlin.gradle.targets.js.yarn.YarnBasics.yarnLockReadTransitiveDependencies$resolveRecursively(YarnBasics.kt:151)
Lucas Schiavini
04/11/2022, 7:23 PMLucas Schiavini
04/12/2022, 2:07 PMThipok Cholsaipant
04/13/2022, 7:01 AMSlackbot
04/13/2022, 9:09 AMRobert Jaros
04/13/2022, 1:19 PMVivek Modi
04/13/2022, 3:06 PMbuild.gradle.kts
. I tried to import code in class but it giving error. Can someone guide me.David Nedrow
04/13/2022, 4:00 PMjsmain
or jstest
directories, nor do I have anything configured for JavaScript in my Gradle files. Yet I see the below output when sync'ing the project. Any thoughts?henrikhorbovyi
04/13/2022, 6:16 PMJames Black
04/13/2022, 7:02 PMenum class ClothingTypes(val clothingLabel:String) {
BLAZER("blazer"),
BLOUSE("blouse"),
UNDERSHIRT("undershirt");
companion object {
fun getNumberOfItems() = values().size
}
}
This code isn't going to compile but basically how would I loop over ClothTypes and get each item in the enum? I did this on the Android side already.
ClothingTypes.allCases.forEach { item in
Toggle(isOn: $isPushEnable) {
item.text
}
}
This is basically what I want to do in a loop.
Toggle(isOn: $isPushEnable) {
Text(list.*get*(index: 0)!.clothingLabel)
}
Toggle(isOn: $isPushEnable) {
Text(list.*get*(index: 1)!.clothingLabel)
}Landry Norris
04/13/2022, 7:27 PMVivek Modi
04/14/2022, 11:42 AMvar versionCode = BuildConfig.VERSION_CODE
it will return 1.1
iOS
let appVersion = "iOS " + (Bundle.main.versionNumber ?? "")
it will return 1.1
The above code is for native. What code should I use in KMM?hfhbd
04/14/2022, 1:23 PMVivek Modi
04/14/2022, 4:19 PMJames Ward
04/14/2022, 7:40 PMe: Could not find "io.ktor:ktor-utils-cinterop-utils" in [/home/jw/projects/kotlin-bars, /home/jw/.konan/klib, /home/jw/.konan/kotlin-native-prebuilt-linux-x86_64-1.6.10/klib/common, /home/jw/.konan/kotlin-native-prebuilt-linux-x86_64-1.6.10/klib/platform/linux_x64]
Any ideas on what that means or how to resolve it?Tianyu Zhu
04/14/2022, 9:45 PMjava-test-fixtures
but for kotlin multiplatform projects?