Rohan Maity
02/27/2022, 7:37 AM./gradlew build
which buids all variant
I tried ./gradlew buildDebug
but it does not generate framework for meChachako
02/27/2022, 6:00 PMAdam Brown
02/27/2022, 8:09 PMcommonMain
source set, and IntelliJ doesn't seem to know about them. Auto-complete won't recommend them. I Can add the import manually and it's fine, but the IDE doesn't seem to know about it. I have tried invalidate and restart, deleting the .idea/
directory and re-importing the project, doesn't matter. I've also tried on separate computers & OSs (OSX & Windows) and its the same. Is this something anyone else has run into?Ankit Dubey
03/01/2022, 6:07 AMUpdate : I was not aware of ktor-client-auth, let me check if it'll help me.
Thanksynsok
03/01/2022, 7:01 AMSimon BRUNOU
03/01/2022, 9:19 AMVivek Modi
03/01/2022, 12:22 PMpererikbergman
03/01/2022, 2:47 PMCould not resolve org.jetbrains.kotlinx:kotlinx-serialization-core:1.2.2
if I build it works for Android, but it doesn't work on iOS.
I get this error:
The following build commands failed:
PhaseScriptExecution [CP-User]\ Build\ shared ... (in target 'shared' from project 'Pods')
I am using CocooaPods if that are in interests here, I am a bit confused and not sure were I should look now, any ideas?Matti MK
03/01/2022, 5:39 PMCocoaPods Acknowledgements
and oss-licenses
, but I’m a bit doubtful that either one would work in this scenario… or at least the CocoaPods
oneMatthew Kruk
03/01/2022, 9:09 PMimport kotlinx.cinterop.*
import platform.WebKit.*
import platform.Foundation.NSZeroRect
class myWebView : WKWebView(frame = NSZeroRect.readValue(), configuration = WKWebViewConfiguration())
r
03/02/2022, 2:51 AMxxfast
03/02/2022, 3:06 AMkhairil.ushan
03/02/2022, 12:22 PMMarc Reichelt
03/02/2022, 4:15 PMcom.foo.SomeClass
will be exported in iOS with Swift names SomeClass
. If our module exports a lot of those, and all the swift files import the module with import SharedCode
, there might be some conflicting Swift classes or classes from other libraries.
Does anyone have a good solution for this? Something like a namespace, or exporting multiple swift packages, or other approaches?Scott Kruse
03/02/2022, 9:51 PMVivek Modi
03/03/2022, 12:15 AMPod::Spec.new do |spec|
spec.name = 'kotlinmultiplatformsharedmodule'
spec.version = '1.0'
spec.homepage = '<https://github.com/vivek-modi/MultiplatformProject|https://github.com/vivek-modi/MultiplatformProject>'
spec.source = { :git => "Not Published", :tag => "Cocoapods/#{spec.name}/#{spec.version}" }
spec.authors = '<mailto:vivekmodi456@gmail.com|vivekmodi456@gmail.com>'
spec.license = ''
spec.summary = 'Some description for the Shared Module'
spec.vendored_frameworks = "build/cocoapods/framework/kotlinmultiplatformsharedmodule.framework"
spec.libraries = "c++"
spec.module_name = "#{spec.name}_umbrella"
spec.ios.deployment_target = '14.1'
spec.pod_target_xcconfig = {
'KOTLIN_PROJECT_PATH' => ':app:kotlinmultiplatformsharedmodule',
'PRODUCT_MODULE_NAME' => 'kotlinmultiplatformsharedmodule',
}
spec.script_phases = [
{
:name => 'Build kotlinmultiplatformsharedmodule',
:execution_position => :before_compile,
:shell_path => '/bin/sh',
:script => <<-SCRIPT
if [ "YES" = "$COCOAPODS_SKIP_KOTLIN_BUILD" ]; then
echo "Skipping Gradle build task invocation due to COCOAPODS_SKIP_KOTLIN_BUILD environment variable set to \"YES\""
exit 0
fi
set -ev
REPO_ROOT="$PODS_TARGET_SRCROOT"
"$REPO_ROOT/../../gradlew" -p "$REPO_ROOT" $KOTLIN_PROJECT_PATH:syncFramework \
-Pkotlin.native.cocoapods.platform=$PLATFORM_NAME \
-Pkotlin.native.cocoapods.archs="$ARCHS" \
-Pkotlin.native.cocoapods.configuration=$CONFIGURATION
SCRIPT
}
]
end
1. I have doubt in source, vendored_framework, libraries, module_name and what is pod_tarvet_xconfig.
2. Did I miss any other attributes for my ios project?
3. Can someone explain me how this pod is know where the framework is? If I add this pod file to different repository so how can I connect themGeorge
03/03/2022, 11:35 AMpublic expect class UUID
In jvmMain
public actual typealias UUID = java.util.UUID
In another part in commonMain:
import java.util.UUID
public data class Account(
public val uuid: UUID,
public val number: String,
public val firstName: String,
public val lastName: String,
public val identityKey: String
)
spierce7
03/03/2022, 7:59 PMMike Wolfson
03/03/2022, 10:14 PMlint.xml
file in my KMM project to allow me to suppress some of the main Lint errors (in particular the Graph generated classes are causing all sorts of issues for me).
I see errors like this:
/Users/MWolfson/.../shared/build/generated/sqldelight/code/AppDatabase/commonMain/com/company/eventable/cache/Event.kt:10:1: Lint error > [indent] Unexpected indentation (2) (should be 4)
So I have created a lint.xml
file with the following:
<?xml version="1.0" encoding="UTF-8"?>
<lint>
<issue id="indent" severity="ignore"/>
</lint>
and I placed this in the following directory:
/Users/MWolfson/.../shared/lint.xml
BUT this doesn't have any effect?!
What am I doing wrong? I have tried all sorts of permutations of values in the ignore file, and also tried to put that file in multiple different locations.
Anyone that can help me with this Lint config challenge I would be eternally grateful.
Also added this to my shared\build.gradle.kts:
android{
...
lint {
quiet = false
abortOnError = true
lintConfig = file ("./lint.xml")
}
Conrad Kramer
03/04/2022, 6:59 AMSunny
03/04/2022, 10:38 AMinternal expect fun formatDate(value: Long, format: String): String
is straight forward. For JavaScript in Kotlin/JS is there any equivalent for formatting the date.
kotlin.js.Date
has no formatting capabilities.
kotlinx-datetime
also seems to lack formatting capabilities. Am I missing something trivial?George
03/04/2022, 11:23 AMharry248
03/04/2022, 12:04 PMSunil Kumar
03/04/2022, 4:36 PMUncaught Kotlin exception: kotlin.native.concurrent.InvalidMutabilityException: mutation attempt of frozen com.buildingengines.sharedmoduletenant.core.service.KmmServiceLocator@1518f08
How to solve this problem, cant we access and update shared module object class variables from swift ios? any workaround for this, Guys Please help. i am stuck with this. I need singleton class in shared module and then inject some native android and ios dependencies into that class on app startup.humblehacker
03/04/2022, 7:06 PMSebastien Leclerc Lavallee
03/05/2022, 5:31 AMplugins {
kotlin("multiplatform")
kotlin("plugin.serialization")
}
version = "1.0.0"
java.sourceCompatibility = JavaVersion.VERSION_1_8
java.targetCompatibility = JavaVersion.VERSION_1_8
kotlin {
js(IR) {
browser()
}
jvm()
sourceSets {
val commonMain by getting {
dependencies {
implementation(kotlin("stdlib-common"))
implementation(Deps.kotlinxSerialization)
}
}
val commonTest by getting {
dependencies {
api("org.jetbrains.kotlin:kotlin-test")
}
}
val jvmMain by getting
val jvmTest by getting
val jsMain by getting
val jsTest by getting
}
}
And now I did add this new ktor module
plugins {
kotlin("jvm")
kotlin("plugin.serialization")
id("application")
}
version = "1.0.0"
java.sourceCompatibility = JavaVersion.VERSION_1_8
java.targetCompatibility = JavaVersion.VERSION_1_8
dependencies {
implementation(kotlin("stdlib"))
implementation(project(":core"))
implementation("io.ktor:ktor-server-core:1.6.1")
implementation("io.ktor:ktor-server-netty:1.6.1")
implementation("io.ktor:ktor-serialization:1.6.1")
implementation("ch.qos.logback:logback-classic:1.2.6")
}
application {
mainClass.set("ca.sebleclerc.api.ApplicationKt")
}
When I execute ./gradlew server:run
I get this error:
* What went wrong:
Could not determine the dependencies of task ':server:run'.
> Could not resolve all task dependencies for configuration ':server:runtimeClasspath'.
> Could not resolve project :core.
Required by:
project :server
> The consumer was configured to find a runtime of a library compatible with Java 8, packaged as a jar, preferably optimized for standard JVMs, and its dependencies declared externally, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm'. However we cannot choose between the following variants of project :core:
- jvmRuntimeElements
- ktlint
All of them match the consumer attributes:
- Variant 'jvmRuntimeElements' capability core:1.0.0 declares a runtime of a library, packaged as a jar, preferably optimized for standard JVMs, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm':
- Unmatched attributes:
- Doesn't say anything about how its dependencies are found (required its dependencies declared externally)
- Doesn't say anything about its target Java version (required compatibility with Java 8)
[... and so on]
I understand it can’t match anything that is produced by my core module but I can’t find anything to make it work. I did tried a few things but nothing worked… Anybody have any clue? Hint?
I am using Kotlin 1.6.20-M1
Thanks for the help 🙂cafonsomota
03/05/2022, 5:35 PMSwiftLint
and everything works, but if I use other ones like AlertToast
or SDWebImageSwiftUI
it doesn’t work.
any ideia why? I’m able to run the app both from xcode and to install it in a real deviceVivek Modi
03/05/2022, 10:17 PMkotlin("native.cocoapods") version "1.6.10"
and I am getting-this weird issue. Can someone help on this org.gradle.internal.exceptions.LocationAwareException: Build file '/Users/vmodi/Downloads/kmm-basic-sample-master/shared/build.gradle.kts' line: 1
Conrad Kramer
03/05/2022, 11:07 PMSomeType.fromByteArray(data: ByteArray)
? Because I know you can’t expect companion objectseygraber
03/07/2022, 3:05 AMexpect abstract class Foo {
internal fun doAFoo() = println("Foo")
}
vs
abstract class SharedFoo {
internal fun doAFoo() = println("Foo")
}
expect abstract class Foo : SharedFoo()
eygraber
03/07/2022, 3:05 AMexpect abstract class Foo {
internal fun doAFoo() = println("Foo")
}
vs
abstract class SharedFoo {
internal fun doAFoo() = println("Foo")
}
expect abstract class Foo : SharedFoo()
russhwolf
03/07/2022, 1:35 PM