Tiago Nunes
05/21/2021, 4:03 PMexpect enum class ImageTargetType {
USER,
DEVICE;
val code: String
}
androidMain:
actual enum class ImageTargetType(
actual val code: String,
@DrawableRes val defaultImageResId: Int?,
) {
USER("User", R.drawable.ic_default_user),
DEVICE("Device", null),
}
This is what I wanted:
commonMain:
expect enum class ImageTargetType(val code: String) {
USER("User"),
DEVICE("Device);
}
androidMain:
actual enum class ImageTargetType(
@DrawableRes val defaultImageResId: Int?,
) {
USER(R.drawable.ic_default_user),
DEVICE(null),
}
Philip Dukhov
05/22/2021, 2:57 PMChar.toChars(0x1F1E6 - 0x41 + ‘A’.code).concatToString()
to get 🇦 emoji (and then build a country flag of two such letters).
But now toChars
marked deprecated. I checked out https://blog.jetbrains.com/kotlin/2021/04/kotlin-1-5-0-rc-released, and I can’t seem to find the replacement. What am I missing?Guilherme Delgado
05/22/2021, 4:41 PMCannot inline bytecode built with JVM target 1.8 into bytecode that is being built with JVM target 1.6. Please specify proper '-jvm-target' option
Adding support for Java 8 language features could solve this issue.
And if I choose “fix it” the IDE adds this to my build.gradle.kts
in shared module:
android {
...
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = "1.8"
}
}
Thing is, kotlinOptions
throws unresolved reference. How can I fix this? Thanks 🙏
ps: don’t know if it’s related or just a coincidence, but I got this error after adding multiplatformSettings lib 🤔Jeff Tycz
05/23/2021, 1:06 AMreleaseImplementation 'io.github.tyczj:myLib-android:0.X.X@aar'
debugImplementation 'io.github.tyczj:myLib-android-debug:0.X.X@aar'
What do I have to do to be able to add the dependency like one would for basically every other KMM or Android library?
like this is what I am looking for
implementation 'io.github.tyczj:myLib-android:0.X.X
Alina Dolgikh [JB]
05/24/2021, 6:51 AMAlfred Lopez
05/24/2021, 4:16 PMkevindmoore
05/25/2021, 3:25 AMNikola Milovic
05/25/2021, 6:16 AMsourceSets {
named("commonMain") {
dependencies {
implementation(project(":common:utils"))
implementation(project(":common:database"))
implementation(project(":common:main"))
implementation(project(":common:edit"))
implementation(Deps.ArkIvanov.MVIKotlin.mvikotlin)
implementation(Deps.ArkIvanov.Decompose.decompose)
implementation(Deps.Badoo.Reaktive.reaktive)
}
}
}
sourceSets {
named("iosMain") {
dependencies {
api(project(":common:database"))
api(project(":common:main"))
api(project(":common:edit"))
}
}
From the Compose Todo sample app. Can someone explain to me why are we implementing the projects in the commonMain and then api them in the iosMain? Doesnt iosMain inherit from the commonMain? What do we achieve/ what's happening here?Mr.Android
05/25/2021, 8:03 AMpablisco
05/25/2021, 10:36 AMJavier
05/25/2021, 11:08 AMsrc/target/kotlin
?
My idea is moving to
project/common/Platform.kt
project/commonTest/PlatformTest.kt
project/ios/Platform.kt
project/iosTest/AnotherTest.kt
project/jvm/Platform.kt
project/jvmTest/AnotherTest.kt
...
project/build.gradle.kts
rb90
05/25/2021, 2:53 PMcompanion object
. Are that classes fully garbage collected on android as well as on ios?Mikołaj Karwowski
05/26/2021, 4:51 PMfelislynx
05/27/2021, 7:58 AMNo enum constant org.jetbrains.kotlin.gradle.plugin.mpp.NativeBuildType.ALPHA
Derek Ellis
05/28/2021, 1:31 AMkevindmoore
05/28/2021, 3:02 AMtulio
05/28/2021, 2:34 PMLena Stepanova
05/28/2021, 3:09 PM> Task :androidApp:compileDebugKotlin FAILED
Does anyone know what's missing?
There is also
> Task :androidApp:kaptDebugKotlin
[WARN] Can't find annotation processor class android.databinding.annotationprocessor.ProcessDataBinding: javax/xml/bind/JAXBException
Also it builds and runs if I just Rebuild in AS. If I do ./gradlew clean build, then it fails
Android build.gradle
plugins {
id("com.android.application")
id("androidx.navigation.safeargs")
kotlin("android")
kotlin("android.extensions")
kotlin("kapt")
id("kotlin-android")
}
version = "1.0"
repositories {
gradlePluginPortal()
google()
jcenter()
mavenCentral()
}
dependencies {
implementation(kotlin("stdlib-jdk7", org.jetbrains.kotlin.config.KotlinCompilerVersion.VERSION))
implementation(project(":shared"))
implementation(Deps.recyclerView)
implementation(Deps.material_x)
implementation(Deps.app_compat_x)
implementation(Deps.core_ktx)
implementation(Deps.Ktor.androidCore)
implementation(Deps.constraintlayout)
implementation(Deps.SqlDelight.runtimeJdk)
implementation(Deps.SqlDelight.driverAndroid)
implementation(Deps.Coroutines.common)
implementation(Deps.Coroutines.android)
implementation(Deps.multiplatformSettings)
implementation(Deps.koinCore)
implementation(Deps.lifecycle_extension)
implementation(Deps.lifecycle_viewmodel)
implementation(Deps.lifecycle_livedata)
implementation(Deps.lifecycle_runtime)
implementation (Deps.navigation_fragment)
implementation (Deps.navigation_ui)
implementation (Deps.drawer)
implementation(Deps.legacySupport)
testImplementation(Deps.junit)
}
android {
compileSdkVersion(29)
defaultConfig {
applicationId = " "
minSdkVersion(21)
targetSdkVersion(29)
versionCode = 11
versionName = "2.0"
}
dataBinding {
isEnabled = true
}
packagingOptions {
exclude("META-INF/*.kotlin_module")
}
signingConfigs {
create("release") {
keyAlias = " "
keyPassword = " "
storeFile = file(" ")
storePassword = " "
}
}
buildTypes {
getByName("release") {
isMinifyEnabled = false
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "<http://proguard-rules.pro|proguard-rules.pro>")
signingConfig = signingConfigs.getByName("release")
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8.toString()
}
lintOptions {
isWarningsAsErrors = true
isAbortOnError = true
}
}
Big Chungus
05/28/2021, 3:42 PMexpect class File(path:String) {
val path: String // <-- Needs to be property on jvm
}
// jvmMain
actual typealias File = java.io.File // <-- hooks in to `private String path` field instead of `public String getPath()` getter
maarten ha
05/28/2021, 6:58 PMbsimmons
05/28/2021, 7:22 PMUnsupportedOperationException
when running CocoaPods when my KMM project uses a nested class. Any ideas? Kotlin 1.4.30Anders Oedlund
05/28/2021, 10:08 PMimplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.5.0-native-mt")
to my commonTest
source set messes up the IDE integration of my project, For example I see the annoying “Cannot find declaration to go to” popup when I Cmd-Click a type to see the declaration, code completion doesn’t work, and so on. Has anyone else experienced this and if so are you aware of a fix or workaround?elye
05/29/2021, 7:25 AM./gradlew packForXcode
it complains…
* What went wrong:
Task 'packForXcode' not found in root project 'Simple Login'.
Aaron Waller
05/29/2021, 11:52 AMno such module 'shared'
I tried rebuilding the project but nothing helps.
When I create a new project it works fine at first.
I also tried to run pod update
but nothing helps. P.S I'm pretty new to KMM and IOS
EDIT
I fixed it by removing
implementation("io.ktor:ktor-client-ios:1.5.4")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-ios:1.5.0-native-mt")
from the iosMain module.
What is the right dependency for using coroutines or something for concurrency?louiscad
05/30/2021, 1:18 AMorg.jetbrains.kotlin.multiplatform.pm20
is?
It was just created for version 1.5.20-M1 (no prior release):https://plugins.gradle.org/plugin/org.jetbrains.kotlin.multiplatform.pm20xxfast
05/30/2021, 4:19 AMandroidMain
in kotlin multiplatform module?Charles Prado
05/30/2021, 2:35 PM> Task :shared:linkDebugFrameworkIos
e: Compilation failed: Deserializer for declaration public kotlinx.coroutines/cancel|-8901161077954086727[0] is not found
Someone here has any idea how can I resolve this coroutines reference?ursus
05/30/2021, 3:43 PMnoone
05/30/2021, 7:38 PMNikola Milovic
05/31/2021, 11:49 AMisSystemInDarkTheme()
. I declare it as
@Composable
expect fun isSystemInDarkTheme() : Boolean
And I implement it on my desktop and my android Mains. But I keep gettting the error
java.lang.NoSuchMethodError: No static method isSystemInDarkTheme(Landroidx/compose/runtime/Composer;I)Z in class
If I try and just make the function be fun isSys... () = true
then I get another expect/ actual error with unresolved reference for another function... Anyone had similar issues? I saw that there are issues with default parameters and suspend funcs with actual/expect but nothing similar to mineNikola Milovic
05/31/2021, 11:49 AMisSystemInDarkTheme()
. I declare it as
@Composable
expect fun isSystemInDarkTheme() : Boolean
And I implement it on my desktop and my android Mains. But I keep gettting the error
java.lang.NoSuchMethodError: No static method isSystemInDarkTheme(Landroidx/compose/runtime/Composer;I)Z in class
If I try and just make the function be fun isSys... () = true
then I get another expect/ actual error with unresolved reference for another function... Anyone had similar issues? I saw that there are issues with default parameters and suspend funcs with actual/expect but nothing similar to mineArkadii Ivanov
05/31/2021, 12:53 PMNikola Milovic
05/31/2021, 2:37 PMArkadii Ivanov
05/31/2021, 2:48 PMcom.nikolam.kmm_weather.ui
instead of com/nikolam/kmm_weather/ui
, this still should work, but maybe it confuses somehow.Nikola Milovic
06/02/2021, 6:48 AMArkadii Ivanov
06/02/2021, 10:15 AMbeta08
release.