rsetkus
11/01/2020, 7:39 PMiosMain
platform target is set to Multiplatform (screenshot bellow). That causes issues on Mac machine. iosMain
cannot access platform code and have to duplicate code in iosArm64Main
and iosX64Main
. What platform target should be selected for iosMain
on which iosArm64
and iosX64
depends on?
Also, noticed that on Android Studio, using new KMM plugin, iosMain
platform is set to multiple values Native(ios_arm64), Native(ios_x64). Is it possible to achieve the same on Intellij (platform target is single selection field)?Nikita Khlebushkin
11/02/2020, 6:46 AMNikky
11/02/2020, 6:59 PMmaven-publish
to mavenLocal()
but when using the library from a jvm project libname-jvm
and navigate to definition idea is unable to attach sources it seemsjeran
11/02/2020, 8:22 PMzalewski.se
11/03/2020, 7:33 AMsetup()
functions that initialize my object and I hide the real constructor from the client. This approach seems far from perfect though 🤔Vinod Rai
11/03/2020, 10:41 AMorg.gradle.api.tasks.TaskExecutionException: Execution failed for task ':SharedCode:compileKotlinIos'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.lambda$executeIfValid$1(ExecuteActionsTaskExecuter.java:205)
at org.gradle.internal.Try$Failure.ifSuccessfulOrElse(Try.java:263)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeIfValid(ExecuteActionsTaskExecuter.java:203)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:184)
at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:109)
at org.gradle.api.internal.tasks.execution.FinalizePropertiesTaskExecuter.execute(FinalizePropertiesTaskExecuter.java:46)
at org.gradle.api.internal.tasks.execution.ResolveTaskExecutionModeExecuter.execute(ResolveTaskExecutionModeExecuter.java:62)
at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:57)
at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:56)
at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:36)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.executeTask(EventFiringTaskExecuter.java:77)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:55)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:52)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:416)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:406)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:165)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:250)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:158)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:102)
at org.gradle.internal.operations.DelegatingBuildOperationExecutor.call(DelegatingBuildOperationExecutor.java:36)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:52)
at org.gradle.execution.plan.LocalTaskNodeExecutor.execute(LocalTaskNodeExecutor.java:41)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:372)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:359)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:352)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:338)
at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.lambda$run$0(DefaultPlanExecutor.java:127)
at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.execute(DefaultPlanExecutor.java:191)
at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.executeNextNode(DefaultPlanExecutor.java:182)
at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.run(DefaultPlanExecutor.java:124)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)
Caused by: org.jetbrains.kotlin.backend.konan.KonanCompilationException: Compilation finished with errors
at org.jetbrains.kotlin.cli.bc.K2Native$Companion$mainNoExitWithGradleRenderer$1.invoke(K2Native.kt:277)
at org.jetbrains.kotlin.cli.bc.K2Native$Companion$mainNoExitWithGradleRenderer$1.invoke(K2Native.kt:260)
william
11/03/2020, 1:27 PMchristophsturm
11/03/2020, 2:17 PM```15:14:37: Executing task 'FetcherKt.main()'...
> Task :r2dbcfun:buildSrc:compileKotlin UP-TO-DATE
> Task :r2dbcfun:buildSrc:compileJava NO-SOURCE
> Task :r2dbcfun:buildSrc:compileGroovy NO-SOURCE
> Task :r2dbcfun:buildSrc:pluginDescriptors UP-TO-DATE
> Task :r2dbcfun:buildSrc:processResources NO-SOURCE
> Task :r2dbcfun:buildSrc:classes UP-TO-DATE
> Task :r2dbcfun:buildSrc:inspectClassesForKotlinIC UP-TO-DATE
> Task :r2dbcfun:buildSrc:jar UP-TO-DATE
> Task :r2dbcfun:buildSrc:assemble UP-TO-DATE
> Task :r2dbcfun:buildSrc:compileTestKotlin NO-SOURCE
> Task :r2dbcfun:buildSrc:pluginUnderTestMetadata UP-TO-DATE
> Task :r2dbcfun:buildSrc:compileTestJava NO-SOURCE
> Task :r2dbcfun:buildSrc:compileTestGroovy NO-SOURCE
> Task :r2dbcfun:buildSrc:processTestResources NO-SOURCE
> Task :r2dbcfun:buildSrc:testClasses UP-TO-DATE
> Task :r2dbcfun:buildSrc:test NO-SOURCE
> Task :r2dbcfun:buildSrc:validatePlugins UP-TO-DATE
> Task :r2dbcfun:buildSrc:check UP-TO-DATE
> Task :r2dbcfun:buildSrc:build UP-TO-DATE
FAILURE: Build failed with an exception.
* Where:
Initialization script '/private/var/folders/99/084s2g6s4pbgwr4_46ysxms80000gn/T/FetcherKt_main__.gradle' line: 27
* What went wrong:
A problem occurred configuring project ':r2dbcfun'.
> Could not create task ':r2dbcfun:FetcherKt.main()'.
> SourceSet with name 'jvmMain' not found.
christophsturm
11/03/2020, 3:00 PMjeran
11/03/2020, 6:43 PMFanis Paschos
11/03/2020, 10:15 PMAli Kabiri
11/04/2020, 8:10 AMTomasz Krakowiak
11/04/2020, 11:17 AMphisch
11/04/2020, 1:17 PMAzur Haljeta
11/04/2020, 9:05 PMapply (plugin = ...)
but it is within the plugins { }
block?why
11/05/2020, 8:07 AMdarkmoon_uk
11/05/2020, 11:01 AMElka
11/06/2020, 1:34 PMFeature
that parses the json, does the checking and then proceed with the response…
The problem is that I cannot call readBytes
twice. The second time it’s empty as the response has already been consumed when doing the validation. Is there any way to do itArkadii Ivanov
11/06/2020, 2:24 PMJozef Matus
11/08/2020, 1:46 PMNSString.create(data = it, encoding = NSUTF8StringEncoding).toString()
and I cant find out how do you know about function name and definition. I have read on github kotlin native repo that those initializers are done via create factory but I cant find any documentation. Where can i find functions declarations please? I looked into platform.Foundation.NSString but I didn’t see create
Michael Pohl
11/09/2020, 3:26 PMDeor
11/09/2020, 6:23 PMThe current version of kotlinx.coroutines, which can be used for iOS, supports usage only in a single thread.
but supposedly there is a multithreded version
implementation ("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.9-native-mt"){
version {
strictly("1.3.9-native-mt")
}
}
I can’t seem to make it work though and in the iOS app Everything is still done on a single background thread.xiaobailong24
11/10/2020, 4:57 AMFerran
11/10/2020, 9:19 AM1.4.0
we can use SharedFlow
. Is this supported from kotlin multiplatform native? in this example:
fun start() {
actionsFlow.asSharedFlow().onEach { action ->
when (action) {
Action.Refresh -> refresh()
Action.Load -> Unit
}
}.launchIn(coroutineScope)
}
suspend fun action(action: Action) {
actionsFlow.emit(action)
}
it works from Android but from iOS there are no events coming through the flow, the coroutineScope implementation (CustomMainScope) that I’m using for iOS is the following:
internal actual fun CustomMainScope(): CoroutineScope = CustomMainScopeImpl()
internal class CustomMainScopeImpl : CoroutineScope {
private val dispatcher = MainDispatcher()
private val job = Job()
private val exceptionHandler = CoroutineExceptionHandler { _, throwable ->
println("${throwable.message}: ${throwable.cause}")
}
override val coroutineContext: CoroutineContext
get() = dispatcher + job + exceptionHandler
}
private class MainDispatcher : CoroutineDispatcher() {
@Suppress("TooGenericExceptionCaught")
override fun dispatch(context: CoroutineContext, block: Runnable) {
dispatch_async(dispatch_get_main_queue()) {
try {
block.run()
} catch (err: Throwable) {
throw err
}
}
}
}
and the dependency for iOS is:
"org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.0"
Is SharedFlow
supposed to work on iOS even if its on a main thread?mzgreen
11/10/2020, 11:35 AMrsetkus
11/10/2020, 3:36 PMandroid {
publishLibraryVariants("release", "debug")
}
I get error:
> Kotlin target 'android' tried to set up publishing for Android build variants that are not library variants or do not exist:
* release
* debug
But when I add buildType
block to android configuration block like this:
android {
....
buildTypes {
val release by creating {
isMinifyEnabled = false
}
val debug by creating {
isDebuggable = true
}
}
}
I get error:
Please initialize at least one Kotlin target in 'kommon (:kommon)'.
mzgreen
11/10/2020, 5:23 PMAmritansh
11/10/2020, 10:18 PMUncaught Kotlin exception: kotlin.native.IncorrectDereferenceException: illegal attempt to access non-shared <object>@c1c6c8 from other thread
at 0 shared 0x000000010ac441bd kfun:kotlin.Throwable#<init>(kotlin.String?){} + 93 (/Users/teamcity/buildAgent/work/cae0e6559deed4c4/runtime/src/main/kotlin/kotlin/Throwable.kt:23:37)
at 1 shared 0x000000010ac3d0ab kfun:kotlin.Exception#<init>(kotlin.String?){} + 91 (/Users/teamcity/buildAgent/work/cae0e6559deed4c4/runtime/src/main/kotlin/kotlin/Exceptions.kt:23:44)
at 2 shared 0x000000010ac3d26b kfun:kotlin.RuntimeException#<init>(kotlin.String?){} + 91 (/Users/teamcity/buildAgent/work/cae0e6559deed4c4/runtime/src/main/kotlin/kotlin/Exceptions.kt:34:44)
at 3 shared 0x000000010ac7006b kfun:kotlin.native.IncorrectDereferenceException#<init>(kotlin.String){} + 91 (/Users/teamcity/buildAgent/work/cae0e6559deed4c4/runtime/src/main/kotlin/kotlin/native/Runtime.kt:30:36)
at 4 shared 0x000000010ac7438d ThrowIllegalObjectSharingException + 621 (/Users/teamcity/buildAgent/work/cae0e6559deed4c4/runtime/src/main/kotlin/kotlin/native/concurrent/Internal.kt:98:11)
at 5 shared 0x000000010ad5a002 _ZN12_GLOBAL__N_128throwIllegalSharingExceptionEP9ObjHeader + 34
at 6 shared 0x000000010ad5e52e _ZNK27BackRefFromAssociatedObject3refEv + 78
at 7 shared 0x000000010ad44bd4 _ZN12_GLOBAL__N_111toKotlinImpEP11objc_objectP13objc_selectorPP9ObjHeader + 52
at 8 shared 0x000000010ad87c81 Kotlin_Interop_refFromObjC + 65
at 9 shared 0x000000010aff65ea _696f2e6b746f723a6b746f722d636c69656e742d696f73_knbridge28 + 330 (/opt/buildAgent/work/a85294440dc5c6e/ktor-client/ktor-client-ios/darwin/src/io/ktor/client/engine/ios/IosResponseReader.kt:100:14)
at 10 shared 0x000000010afff37a _696f2e6b746f723a6b746f722d636c69656e742d696f73_kncfun30 + 74
at 11 CFNetwork 0x00007fff22f31ade _CFNetworkHTTPConnectionCacheSetLimit + 207606
at 12 Foundation 0x00007fff25752d51 __NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK__ + 7
at 13 Foundation 0x00007fff25752c49 -[NSBlockOperation main] + 98
at 14 Foundation 0x00007fff25755bd6 __NSOPERATION_IS_INVOKING_MAIN__ + 17
at 15 Foundation 0x00007fff25751e49 -[NSOperation start] + 731
at 16 Foundation 0x00007fff25756530 __NSOPERATIONQUEUE_IS_STARTING_AN_OPERATION__ + 17
at 17 Foundation 0x00007fff2575603a __NSOQSchedule_f + 182
at 18 libdispatch.dylib 0x000000010b75a3c9 _dispatch_block_async_invoke2 + 83
at 19 libdispatch.dylib 0x000000010b74bd48 _dispatch_client_callout + 8
at 20 libdispatch.dylib 0x000000010b759de6 _dispatch_main_queue_callback_4CF + 1500
at 21 CoreFoundation 0x00007fff23bd4049 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
at 22 CoreFoundation 0x00007fff23bceca9 __CFRunLoopRun + 2329
at 23 CoreFoundation 0x00007fff23bce066 CFRunLoopRunSpecific + 438
at 24 GraphicsServices 0x00007fff384c0bb0 GSEventRunModal + 65
at 25 UIKitCore 0x00007fff48092d4d UIApplicationMain + 1621
at 26 iosApp-sample 0x000000010a8b905b main + 75 (/User/iosApp-sample/iosApp-sample/AppDelegate.swift:4:7)
at 27 libdyld.dylib 0x00007fff5227ec25 start + 1
This is what my implementation looks like
fun postRequest() {
MainScope().launch {
withContext(Dispatchers.Default) {
HttpClient().post("URL"){
body = "some json"
}
}
}
}
This request is working fine for the Android application and only throws the exception in iOS. Also if I try to run HttpClient().post on the main thread, it works fine on iOS and I am successfully able to send the request.
ktorVersion = "1.4.1"
coroutinesVersion = "1.3.9-native-mt-2"
Based on this documentationhttps://github.com/Kotlin/kotlinx.coroutines/blob/native-mt/kotlin-native-sharing.md#switching-threads for "1.3.9-native-mt-2"
my understanding is it should work.
Any help is appreciated!william
11/10/2020, 11:18 PMBigInteger
type of class?tylerwilson
11/11/2020, 1:17 AMtylerwilson
11/11/2020, 1:17 AMSam
11/11/2020, 1:55 PMtylerwilson
11/11/2020, 1:56 PMSam
11/11/2020, 5:36 PMtylerwilson
11/11/2020, 5:58 PM