Run Kotlin/JS libraries in Kotlin/JVM and Kotlin/Native programs

Last update: Aug 13, 2022

Zipline

This library streamlines using Kotlin/JS libraries from Kotlin/JVM and Kotlin/Native programs. It makes it possible to do continuous deployment of mobile apps, just like we do for servers and web applications.

It'd be simpler to do continuous deploys via the App Store & Play Store! But that process is too slow. Even if we could release via these channels every day, we can’t guarantee that user’s devices will take the updates immediately. For Cash App we support apps that haven’t been updated for a full year.

(Looking for Duktape Android?)

QuickJS

This library uses the QuickJS embeddable JavaScript engine to execute Kotlin/JS. It's included in this library and supports both Android and the JVM.

QuickJS Usage

try (QuickJs engine = QuickJs.create()) {
  Log.d("Greeting", engine.evaluate("'hello world'.toUpperCase();").toString());
}

For long-lived usage feel free to call QuickJs.create() and retain the returned instance for as long as you need. Be sure to call .close() when you are done to avoid leaking native components.

Supported Java Types

Currently, the following Java types are supported when interfacing with JavaScript:

  • boolean and Boolean
  • int and Integer - as an argument only (not a return value) when calling JavaScript from Java.
  • double and Double
  • String
  • void - as a return value.

Object is also supported in declarations, but the type of the actual value passed must be one of the above or null.

Calling Java from JavaScript

You can provide a Java object for use as a JavaScript global, and call Java functions from JavaScript!

Example

Suppose we wanted to expose the functionality of Okio's ByteString in JavaScript to convert hex-encoded strings back into UTF-8. First, define a Java interface that declares the methods you would like to call from JavaScript:

interface Utf8 {
  String fromHex(String hex);
}

Next, implement the interface in Java code (we leave the heavy lifting to Okio):

Utf8 utf8 = new Utf8() {
  @Override public String fromHex(String hex) {
    return okio.ByteString.decodeHex(hex).utf8();
  }
};

Now you can set the object to a JavaScript global, making it available in JavaScript code:

// Attach our interface to a JavaScript object called Utf8.
engine.set("Utf8", Utf8.class, utf8);

String greeting = (String) engine.evaluate(""
    // Here we have a hex encoded string.
    + "var hexEnc = 'EC9588EB8595ED9598EC84B8EC9A9421';\n"
    // Call out to Java to decode it!
    + "var message = Utf8.fromHex(hexEnc);\n"
    + "message;");

Log.d("Greeting", greeting);

Calling JavaScript from Java

You can attach a Java interface to a JavaScript global object, and call JavaScript functions directly from Java! The same Java types are supported for function arguments and return values as the opposite case above.

Example

TODO fix this example, as it no longer works with QuickJS! You should still be able to understand what is going on, though.

Imagine a world where we don't have Okio's ByteString. Fortunately, there's a [Duktape builtin][dukdec] that allows us to convert hex-encoded strings back into UTF-8! We can easily set up a proxy that allows us to use it directly from our Java code. First, define a Java interface that declares the JavaScript methods you would like to call:

interface Utf8 {
  String fromHex(String hex);
}

Next, we define a global JavaScript object in Duktape to connect to:

// Note that Duktape.dec returns a Buffer, we must convert it to a String return value.
engine.evaluate(""
    + "var Utf8 = {\n"
    + "  fromHex: function(v) { return String(Duktape.dec('hex', v)); }\n"
    + "};");

Now you can connect our interface to the JavaScript global, making it available in Java code:

// Connect our interface to a JavaScript object called Utf8.
Utf8 utf8 = engine.get("Utf8", Utf8.class);

// Call into the JavaScript object to decode a string.
String greeting = utf8.fromHex("EC9588EB8595ED9598EC84B8EC9A9421");
Log.d("Greeting", greeting);

Download

This project supports both Android and Java. On Java only Linux and macOS are currently supported.

repositories {
  mavenCentral()
}
dependencies {
  implementation 'app.cash.zipline:zipline:0.1.0'
}

This library is provided as a "fat" .aar with native binaries for all available architectures. To reduce your binary size, use ABI filtering/splitting when building an APK and/or enable Android App Bundles.

Snapshots of the development version are available in Sonatype's snapshots repository.

repository {
  mavenCentral()
  maven {
    url 'https://oss.sonatype.org/content/repositories/snapshots/'
  }
}
dependencies {
  implementation 'app.cash.zipline:zipline:1.0.0-SNAPSHOT'
}

Building

For Android

$ ./gradlew :quickjs:android:build

The build system will automatically cross-compile the native library to all applicable ABIs and create the fat .aar in quickjs/android/build/outputs/aar/.

This will not run the tests. You must have a working device or emulator connected at which point you can explicitly run them.

$ ./gradlew :quickjs:android:connectedCheck

For the JVM

First, build the native library for your host OS:

$ cmake -S quickjs/jvm/ -B build/jni/ -DQUICKJS_VERSION="$(cat quickjs/common/native/quickjs/VERSION)"
$ cmake --build build/jni/ --verbose

Next, copy the resulting binary into the resources of the JVM project:

$ mkdir -p quickjs/jvm/src/main/resources/
$ cp -v build/jni/libquickjs.* quickjs/jvm/src/main/resources/

Finally, build the platform-specific .jar and run the tests:

$ ./gradlew :quickjs:jvm:build

The .jar will be available in quickjs/jvm/build/libs/.

License

Copyright 2015 Square, Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Note: The included C code from QuickJS is licensed under MIT.

Duktape

This repository used to host an Android-specific packaging of the Duktape engine. We have changed to using QuickJS with exactly the same features and API. The Duktape history is still present in this repo as are the release tags. Available versions are listed on Maven central.

GitHub

https://github.com/cashapp/zipline
Comments
  • 1. Call Java functions from duktape

    It would be useful to be able to call native Java/Android functions from within JavaScript, similar to how Rhino allows importing native functions.

    For my specific case there is no need to implement full support for conversion between Java and JS objects, it would be enough to just be able to call a function with primitive arguments like double, String, int.

    Reviewed by josdejong at 2015-12-01 13:04
  • 2. Zipline JVM artifacts assume Macs are X64

    I’m getting failures like this from our internal releases:

    > /private/var/folders/6n/t4d4n1c506d9m_l6t331gftm0000gn/T/quickjs12749920372263119972.tmp: dlopen(/private/var/folders/6n/t4d4n1c506d9m_l6t331gftm0000gn/T/quickjs12749920372263119972.tmp, 0x0001): tried: '/private/var/folders/6n/t4d4n1c506d9m_l6t331gftm0000gn/T/quickjs12749920372263119972.tmp' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e')), '/usr/lib/quickjs12749920372263119972.tmp' (no such file)
    
    Reviewed by swankjesse at 2022-02-09 21:29
  • 3. JNI ERROR (app bug): local reference table overflow (max=512)

    JNI ERROR (app bug): local reference table overflow (max=512) art/runtime/indirect_reference_table.cc:132] local reference table dump: art/runtime/indirect_reference_table.cc:132] Last 10 entries (of 512): art/runtime/indirect_reference_table.cc:132] 511: 0x134f6250 libcore.util.ZoneInfo art/runtime/indirect_reference_table.cc:132] 510: 0x134f6220 libcore.util.ZoneInfo art/runtime/indirect_reference_table.cc:132] 509: 0x134f61f0 libcore.util.ZoneInfo art/runtime/indirect_reference_table.cc:132] 508: 0x134f61c0 libcore.util.ZoneInfo art/runtime/indirect_reference_table.cc:132] 507: 0x134f6190 libcore.util.ZoneInfo art/runtime/indirect_reference_table.cc:132] 506: 0x134f6160 libcore.util.ZoneInfo art/runtime/indirect_reference_table.cc:132] 505: 0x134f6130 libcore.util.ZoneInfo art/runtime/indirect_reference_table.cc:132] 504: 0x134f6100 libcore.util.ZoneInfo art/runtime/indirect_reference_table.cc:132] 503: 0x134f60d0 libcore.util.ZoneInfo art/runtime/indirect_reference_table.cc:132] 502: 0x134f60a0 libcore.util.ZoneInfo art/runtime/indirect_reference_table.cc:132] Summary: art/runtime/indirect_reference_table.cc:132] 2 of $Proxy21 (1 unique instances) art/runtime/indirect_reference_table.cc:132] 2 of $Proxy20 (1 unique instances) art/runtime/indirect_reference_table.cc:132] 1 of java.lang.Thread art/runtime/indirect_reference_table.cc:132] 2 of java.lang.reflect.Method (2 unique instances) art/runtime/indirect_reference_table.cc:132] 4 of java.lang.String (2 unique instances) art/runtime/indirect_reference_table.cc:132] 1 of java.util.ArrayList art/runtime/indirect_reference_table.cc:132] 1 of java.lang.Object[] (1 elements) art/runtime/indirect_reference_table.cc:132] 1 of java.lang.Object[] (2 elements) art/runtime/indirect_reference_table.cc:132] 498 of libcore.util.ZoneInfo (498 unique instances)

    I getting the above error when i am using

    get(final String name, final Class type)

    the type interface is this:

      interface JsBinder {
    
            fun androidWrapper(functionName: String, **input**: String): String
    
        }
    

    the String **input** in the interface is an Array of 44 objects. Work fine when less elements in array are present.

    Originally posted by @resengupta in https://github.com/square/duktape-android/issues/90#issuecomment-444849438

    Reviewed by resengupta at 2018-12-06 14:21
  • 4. DuktapeException: TypeError: cannot read property 'prototype' of undefined

       Caused by: com.squareup.duktape.DuktapeException: TypeError: cannot read property 'prototype' of undefined
                                                                        at JavaScript.runInContext(?:43226)
                                                                        at JavaScript.s(?:1)
                                                                        at com.squareup.duktape.Duktape.evaluate(Native Method)
                                                                        at com.squareup.duktape.Duktape.evaluate(Duktape.java:69)
    

    here is my code:

    val duktape = Duktape.create()
            try {
                duktape.evaluate(assets.open("bundle.js").reader(Charset.forName("UTF-8")).readText())
                LogHelper.LogE("--->" + duktape.evaluate("generateAddress").toString())
            } finally {
                duktape.close()
            }
    
    Address.prototype.isPayToScriptHash = function() {
      return this.type === Address.PayToScriptHash;
    };
    
    Reviewed by badboy-tian at 2017-10-11 07:40
  • 5. Rhino over Duktape

    Hi,

    I was searching for a JS engine for Android and it seems that Rhino is ~10% more efficient than Duktape. What do you think about it? Maybe a real benchmark could be helpful...

    Reviewed by HugoGresse at 2016-12-09 10:22
  • 6. When call Duktape.close() , native crash occured.

    **I'm using duktape-android in Thread and multi.

    when I run duktape-android about over 300 times, out of memory occured. So I called Duktape at end of script. When I called Duktape.close(), native crash occured. Below is the log.**

    12-18 10:00:12.897 29666-714/com.kwic.smartaibmonitormaster E/libc++abi: Pure virtual function called! 12-18 10:00:12.898 29666-714/com.kwic.smartaibmonitormaster A/libc: Fatal signal 6 (SIGABRT), code -6 in tid 714 (Thread-4)

                                                                    [ 12-18 10:00:12.899   476:  476 W/         ]
                                                                    debuggerd: handling request: pid=29666 uid=10207 gid=10207 tid=714
    

    12-18 10:00:12.972 759-759/? A/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** 12-18 10:00:12.973 759-759/? A/DEBUG: Build fingerprint: 'lge/lucye_lgu_kr/lucye:7.0/NRD90U/172411421f9f3:user/release-keys' 12-18 10:00:12.973 759-759/? A/DEBUG: Revision: '12' 12-18 10:00:12.973 759-759/? A/DEBUG: ABI: 'arm64' 12-18 10:00:12.973 759-759/? A/DEBUG: pid: 29666, tid: 714, name: Thread-4 >>> com.kwic.smartaibmonitormaster <<< 12-18 10:00:12.973 759-759/? A/DEBUG: signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr -------- 12-18 10:00:12.973 759-759/? A/DEBUG: x0 0000000000000000 x1 00000000000002ca x2 0000000000000006 x3 0000000000000008 12-18 10:00:12.973 759-759/? A/DEBUG: x4 ffffffffffffffff x5 8080800000000000 x6 0000000000808080 x7 fefeff2063646b6b 12-18 10:00:12.973 759-759/? A/DEBUG: x8 0000000000000083 x9 ffffffffffffffdf x10 0000000000000000 x11 0000000000000001 12-18 10:00:12.973 759-759/? A/DEBUG: x12 ffffffffffffffff x13 0000000000000000 x14 0000000000000000 x15 00357c6e098c12a3 12-18 10:00:12.973 759-759/? A/DEBUG: x16 00000075b8551ed0 x17 00000075b84fb3f4 x18 00000000ffffffff x19 00000075ac8c14f8 12-18 10:00:12.973 759-759/? A/DEBUG: x20 0000000000000006 x21 00000075ac8c1450 x22 0000000000000000 x23 00000000ffffffc8 12-18 10:00:12.973 759-759/? A/DEBUG: x24 00000075ac8bdd60 x25 00000075ac8bdc30 x26 00000075ac8bdc70 x27 0000000000000001 12-18 10:00:12.973 759-759/? A/DEBUG: x28 00000075ad48f728 x29 00000075ac8bdb40 x30 00000075b84f8884 12-18 10:00:12.973 759-759/? A/DEBUG: sp 00000075ac8bdb20 pc 00000075b84fb3fc pstate 0000000060000000 12-18 10:00:12.983 759-759/? A/DEBUG: backtrace: 12-18 10:00:12.983 759-759/? A/DEBUG: #00 pc 000000000006c3fc /system/lib64/libc.so (tgkill+8) 12-18 10:00:12.983 759-759/? A/DEBUG: #01 pc 0000000000069880 /system/lib64/libc.so (pthread_kill+64) 12-18 10:00:12.983 759-759/? A/DEBUG: #02 pc 0000000000024658 /system/lib64/libc.so (raise+24) 12-18 10:00:12.983 759-759/? A/DEBUG: #03 pc 000000000001d074 /system/lib64/libc.so (abort+52) 12-18 10:00:12.983 759-759/? A/DEBUG: #04 pc 000000000008c72c /data/app/com.kwic.smartaibmonitormaster-2/lib/arm64/libduktape.so 12-18 10:00:12.983 759-759/? A/DEBUG: #05 pc 000000000008a5b0 /data/app/com.kwic.smartaibmonitormaster-2/lib/arm64/libduktape.so (__cxa_pure_virtual+16) 12-18 10:00:12.983 759-759/? A/DEBUG: #06 pc 0000000000017b64 /data/app/com.kwic.smartaibmonitormaster-2/lib/arm64/libduktape.so 12-18 10:00:12.983 759-759/? A/DEBUG: #07 pc 0000000000017504 /data/app/com.kwic.smartaibmonitormaster-2/lib/arm64/libduktape.so 12-18 10:00:12.983 759-759/? A/DEBUG: #08 pc 0000000000078d5c /data/app/com.kwic.smartaibmonitormaster-2/lib/arm64/libduktape.so 12-18 10:00:12.983 759-759/? A/DEBUG: #09 pc 000000000007f564 /data/app/com.kwic.smartaibmonitormaster-2/lib/arm64/libduktape.so 12-18 10:00:12.983 759-759/? A/DEBUG: #10 pc 000000000007a1b0 /data/app/com.kwic.smartaibmonitormaster-2/lib/arm64/libduktape.so 12-18 10:00:12.983 759-759/? A/DEBUG: #11 pc 0000000000078e24 /data/app/com.kwic.smartaibmonitormaster-2/lib/arm64/libduktape.so 12-18 10:00:12.983 759-759/? A/DEBUG: #12 pc 0000000000021b98 /data/app/com.kwic.smartaibmonitormaster-2/lib/arm64/libduktape.so 12-18 10:00:12.984 759-759/? A/DEBUG: #13 pc 0000000000024fd4 /data/app/com.kwic.smartaibmonitormaster-2/lib/arm64/libduktape.so (duk_eval_raw+188) 12-18 10:00:12.984 759-759/? A/DEBUG: #14 pc 0000000000014500 /data/app/com.kwic.smartaibmonitormaster-2/lib/arm64/libduktape.so 12-18 10:00:12.984 759-759/? A/DEBUG: #15 pc 0000000000015bf8 /data/app/com.kwic.smartaibmonitormaster-2/lib/arm64/libduktape.so (Java_com_squareup_duktape_Duktape_evaluate__JLjava_lang_String_2Ljava_lang_String_2+52) 12-18 10:00:12.984 759-759/? A/DEBUG: #16 pc 00000000001f324c /data/app/com.kwic.smartaibmonitormaster-2/oat/arm64/base.odex (offset 0x1e9000)

    Reviewed by jeonhoeun at 2017-12-18 01:00
  • 7. local reference table overflow (max=512) error

    when I call duktape.set ("someName" , interface.class, interface instance );

    local reference table overflow (max=512) error occured

    interface method has 40 methods.

    and if I set method count 30, the error is not occured.

    so I'm call set two interface.class.

    the first interface has 20 methods. and second interfacde has 20 method.

    Is it a bug?

    Reviewed by jeonhoeun at 2017-09-05 00:10
  • 8. JNI ERROR (app bug): accessed deleted global reference

    09-10 12:11:44.183 7478 8530 E     art                                          JNI ERROR (app bug): accessed deleted global reference 0x100752
    09-10 12:11:44.263 7478 8530 F     art                                          art/runtime/java_vm_ext.cc:410] JNI DETECTED ERROR IN APPLICATION: use of deleted global reference 0x100752
    09-10 12:11:44.263 7478 8530 F     art                                          art/runtime/java_vm_ext.cc:410]     from long com.squareup.duktape.Duktape.createContext()
    09-10 12:11:44.263 7478 8530 F     art                                          art/runtime/java_vm_ext.cc:410] "RxIoScheduler-20" daemon prio=5 tid=82 Runnable
    09-10 12:11:44.263 7478 8530 F     art                                          art/runtime/java_vm_ext.cc:410]   | group="main" sCount=0 dsCount=0 obj=0x339f5b20 self=0x7f0474d000
    09-10 12:11:44.263 7478 8530 F     art                                          art/runtime/java_vm_ext.cc:410]   | sysTid=8530 nice=0 cgrp=bg_non_interactive sched=0/0 handle=0x7f60d03440
    09-10 12:11:44.263 7478 8530 F     art                                          art/runtime/java_vm_ext.cc:410]   | state=R schedstat=( 100964150 70105114 208 ) utm=9 stm=1 core=5 HZ=100
    09-10 12:11:44.263 7478 8530 F     art                                          art/runtime/java_vm_ext.cc:410]   | stack=0x7f60c01000-0x7f60c03000 stackSize=1037KB
    09-10 12:11:44.263 7478 8530 F     art                                          art/runtime/java_vm_ext.cc:410]   | held mutexes= "mutator lock"(shared held)
    09-10 12:11:44.263 7478 8530 F     art                                          art/runtime/java_vm_ext.cc:410]   native: #00 pc 000000000048a5b0  /system/lib64/libart.so (_ZN3art15DumpNativeStackERNSt3__113basic_ostreamIcNS0_11char_traitsIcEEEEiP12BacktraceMapPKcPNS_9ArtMethodEPv+200)
    09-10 12:11:44.263 7478 8530 F     art                                          art/runtime/java_vm_ext.cc:410]   native: #01 pc 0000000000459358  /system/lib64/libart.so (_ZNK3art6Thread4DumpERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEEP12BacktraceMap+224)
    09-10 12:11:44.263 7478 8530 F     art                                          art/runtime/java_vm_ext.cc:410]   native: #02 pc 000000000030d764  /system/lib64/libart.so (_ZN3art9JavaVMExt8JniAbortEPKcS2_+1004)
    09-10 12:11:44.263 7478 8530 F     art                                          art/runtime/java_vm_ext.cc:410]   native: #03 pc 000000000030e138  /system/lib64/libart.so (_ZN3art9JavaVMExt9JniAbortFEPKcS2_z+224)
    09-10 12:11:44.263 7478 8530 F     art                                          art/runtime/java_vm_ext.cc:410]   native: #04 pc 000000000045988c  /system/lib64/libart.so (_ZNK3art6Thread13DecodeJObjectEP8_jobject+548)
    09-10 12:11:44.263 7478 8530 F     art                                          art/runtime/java_vm_ext.cc:410]   native: #05 pc 0000000000351d3c  /system/lib64/libart.so (_ZN3art3JNI17GetStaticMethodIDEP7_JNIEnvP7_jclassPKcS6_+464)
    09-10 12:11:44.263 7478 8530 F     art                                          art/runtime/java_vm_ext.cc:410]   native: #06 pc 00000000001529c8  /system/lib64/libart.so (_ZN3art8CheckJNI17GetStaticMethodIDEP7_JNIEnvP7_jclassPKcS6_+560) 
    
    Reviewed by NitroXenon at 2016-09-10 04:18
  • 9. [Question] Composables in Zipline

    Hey team - Version 1.2 of Compose Multiplatform will support material and UI on JS and iOS. Will passing Composables by Zipline be possible in future?

    Reviewed by matt-ramotar at 2022-03-25 01:58
  • 10. zipline-library reorg & Upstream KotlinJsCompile configuration to Zipline Plugin

    If this works, we won't need to manually set this on every project that uses Zipline plugin https://github.com/cashapp/zipline/blob/d5e3f7b6b2554a93e3dc47799610aae6c9dc42a4/zipline/testing/build.gradle.kts#L68-L75

    Thanks to #gradle Slack channel for help

    Reviewed by adrw at 2021-12-13 22:31
  • 11. Zipline Loader Plan

    This returns once all of the modules in [manifest] have been loaded into [zipline]. This function can be canceled, but doing so leaves [zipline] in an undefined state.

    version zero: download each file sequentially call Zipline.loadJsModule()

    version one: download each file sequentially if not stored on disk store files on disk using okio.FileSystem gotcha: atomicMove() gotcha: download fails, this will leave garbage around forever call Zipline.loadJsModule()

    version two: same as version one, but it doesn't leave garbage around forever probably Sqlite to store downloads in flight call Zipline.loadJsModule()

    version three: download in parallel load as soon as downloads finish honor topo sort https://github.com/square/okhttp/blob/master/okhttp/src/main/kotlin/okhttp3/internal/cache/DiskLruCache.kt

    version four: prune old files note that a file that has been pruned might also be loaded shortly after pruning; perhaps even between deleting on disk and deleting in DB

    Reviewed by adrw at 2021-11-29 20:24
  • 12. Sample crashes with Flow serialization issue

    I’m running the emoji search sample and it’s bitrotted.

    2022-08-15 12:46:38.358 6126-6151/com.example.zipline.emojisearch.debug E/Zipline: java.lang.Exception: SerializationException: Class 'ChannelFlowBuilder' is not registered for polymorphic serialization in the scope of 'Flow'.
        Mark the base class as 'sealed' or register the serializer explicitly.
            at captureStack (../../../../../runtime/coreRuntime.kt:86)
            at SerializationException_init_$Create$_0 (kotlinx-serialization-kotlinx-serialization-core-js-ir.js)
            at throwSubtypeNotRegistered_0 (../../../../../Z:/BuildAgent/work/b2fef8360e1bcf3d/core/commonMain/src/kotlinx/serialization/internal/AbstractPolymorphicSerializer.kt:102)
            at throwSubtypeNotRegistered (../../../../../Z:/BuildAgent/work/b2fef8360e1bcf3d/core/commonMain/src/kotlinx/serialization/internal/AbstractPolymorphicSerializer.kt:113)
            at findPolymorphicSerializer (../../../../../Z:/BuildAgent/work/b2fef8360e1bcf3d/core/commonMain/src/kotlinx/serialization/PolymorphicSerializer.kt:109)
            at <anonymous> (../../../../../Z:/BuildAgent/work/b2fef8360e1bcf3d/core/commonMain/src/kotlinx/serialization/internal/AbstractPolymorphicSerializer.kt:32)
            at <anonymous> (../../../../../Polymorphic.kt:89)
            at <anonymous> (../../../../../Z:/BuildAgent/work/b2fef8360e1bcf3d/core/commonMain/src/kotlinx/serialization/encoding/AbstractEncoder.kt:80)
            at <anonymous> (../../../../../commonMainSources/libraries/stdlib/src/kotlin/util/Preconditions.kt:287)
            at <anonymous> (zipline-root-zipline.js)
            at <anonymous> (../../../../../Polymorphic.kt:89)
            at <anonymous> (../../../../../Z:/BuildAgent/work/b2fef8360e1bcf3d/core/commonMain/src/kotlinx/serialization/encoding/AbstractEncoder.kt:80)
            at <anonymous> (../../../../../Z:/BuildAgent/work/b2fef8360e1bcf3d/core/commonMain/src/kotlinx/serialization/encoding/Encoding.kt:287)
            at <anonymous> (zipline-root-zipline.js)
            at <anonymous> (../../../../../Polymorphic.kt:89)
            at encodeToDynamic_0 (../../../../../DynamicEncoders.kt:42)
            at encodeToDynamic (../../../../../Dynamics.kt)
            at encodeToStringFast (../../../../../jsonJs.kt)
            at <anonymous> (../../../../../CallCodec.kt:56)
            at <anonymous> (../../../../../OutboundCallHandler.kt:52)
            at <anonymous> (../../../../../SuspendCallback.kt)
            at <anonymous> (zipline-root-zipline.js)
            at <anonymous> (../../../../../InboundService.kt:713)
            at <anonymous> (../../../../../InboundService.kt)
            at l (zipline-root-zipline.js)
            at <anonymous> (../../../../../src/kotlin/coroutines_13/IntrinsicsJs.kt:163)
            at <anonymous> (../../../../../src/kotlin/coroutines_13/CoroutineImpl.kt:55)
            at <anonymous> (kotlin-kotlin-stdlib-js-ir.js)
            at <anonymous> (../../../../../DispatchedTask.kt:10131)
            at <anonymous> (../../../../../commonMainSources/libraries/stdlib/src/kotlin/util/Standard.kt:153)
            at <anonymous> (../../../../../JSDispatcher.kt:19)
            at apply (native)
            at <anonymous> (../../../../../GlobalBridge.kt:70)
            at <anonymous> (../../../../../platform.kt)
            at <anonymous> (zipline-root-zipline.js)
            at <anonymous> (../../../../../InboundService.kt:835)
            at <anonymous> (../../../../../Endpoint.kt:79)
            at <anonymous> (zipline-root-zipline.js)
            at <anonymous> (../../../../../GlobalBridge.kt)
            at <anonymous> (zipline-root-zipline.js)
            at app.cash.zipline.internal.JsPlatform$Companion$Adapter$GeneratedOutboundService.runJob(platform.kt:37)
            at app.cash.zipline.internal.CoroutineEventLoop$DelayedJob$run$1.invokeSuspend(CoroutineEventLoop.kt:59)
            at app.cash.zipline.internal.CoroutineEventLoop$DelayedJob$run$1.invoke(Unknown Source:8)
            at app.cash.zipline.internal.CoroutineEventLoop$DelayedJob$run$1.invoke(Unknown Source:4)
            at kotlinx.coroutines.intrinsics.UndispatchedKt.startCoroutineUndispatched(Undispatched.kt:55)
            at kotlinx.coroutines.BuildersKt__Builders_commonKt.startCoroutineImpl(Builders.common.kt:198)
            at kotlinx.coroutines.BuildersKt.startCoroutineImpl(Unknown Source:1)
            at kotlinx.coroutines.AbstractCoroutine.start(AbstractCoroutine.kt:134)
            at kotlinx.coroutines.BuildersKt__Builders_commonKt.launch(Builders.common.kt:56)
            at kotlinx.coroutines.BuildersKt.launch(Unknown Source:1)
    2022-08-15 12:46:38.358 6126-6151/com.example.zipline.emojisearch.debug E/Zipline:     at kotlinx.coroutines.BuildersKt__Builders_commonKt.launch$default(Builders.common.kt:47)
            at kotlinx.coroutines.BuildersKt.launch$default(Unknown Source:1)
            at app.cash.zipline.internal.CoroutineEventLoop$DelayedJob.run(CoroutineEventLoop.kt:57)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
            at java.lang.Thread.run(Thread.java:920)
    
    Reviewed by swankjesse at 2022-08-15 16:52
  • 13. ZiplineFunction.name is the signature, not the name

    It’s a string like this:

    fun ping(app.cash.zipline.SampleRequest): app.cash.zipline.SampleResponse
    

    I think the name should be just ping and the rest should be the signature?

    Reviewed by swankjesse at 2022-08-11 18:27
  • 14. Nicer syntax for Gradle plugin configuration

    Today:

    tasks.withType(ZiplineCompileTask::class) {
      mainFunction.set("com.squareup.cash.treehouse.playground.prepareTreehouse")
    }
    

    Possible alternative:

    zipline {
      mainFunction.set("com.squareup.cash.treehouse.playground.prepareTreehouse")
    }
    
    Reviewed by swankjesse at 2022-08-11 18:24
  • 15. quickjs link failed in iOS.

    e: Compilation failed: Linking globals named 'lre_id_start_table_ascii': symbol multiply defined!

    • Source files:
    • Compiler version info: Konan: 1.6.21 / Kotlin: 1.6.21
    • Output kind: FRAMEWORK

    e: java.lang.Error: Linking globals named 'lre_id_start_table_ascii': symbol multiply defined!

    Task :zipline:linkPodDebugFrameworkIosArm64 FAILED :zipline:linkPodDebugFrameworkIosArm64 (Thread[Execution worker for ':' Thread 7,5,main]) completed. Took 8.931 secs.

    Reviewed by showtestlog at 2022-08-10 09:40
Related tags
A Kotlin library providing a simple, high-performance way to use off-heap native memory in JVM applications.
 A Kotlin library providing a simple, high-performance way to use off-heap native memory in JVM applications.

native_memory_allocator A library which uses sun.misc.Unsafe to allocate off-heap native memory. Motivation The goal of this project is to provide a s

Jun 27, 2022
🎑 Up to date IANA timezone database library for Kotlin (JVM, JS, Native)

?? IANA Timezone Library for Kotlin Multiplatform Up to date IANA timezone database library for Kotlin (JVM, JS, Native) Usage import org.noelware.ian

Jun 18, 2022
Yet Another Native Loader for the JVM.

yanl - yet another native loader Yet another Native library extractor/loader for the JVM, written in Kotlin. why other libraries simply don't fit my n

Apr 2, 2022
:bouquet: An easy way to persist and run code block only as many times as necessary on Android.
:bouquet: An easy way to persist and run code block only as many times as necessary on Android.

Only ?? An easy way to persist and run code block only as many times as necessary on Android. Download Gradle Add below codes to your root build.gradl

Jul 23, 2022
:bouquet: An easy way to persist and run code block only as many times as necessary on Android.
:bouquet: An easy way to persist and run code block only as many times as necessary on Android.

Only ?? An easy way to persist and run code block only as many times as necessary on Android. Download Gradle Add below codes to your root build.gradl

Apr 14, 2021
Run shell commands from a Kotlin script or application with ease
Run shell commands from a Kotlin script or application with ease

Run shell commands from a Kotlin script or application with ease. Turtle simplifies the process of running external commands and processes from your K

Aug 11, 2022
Gradle plugin adding a task to run a Paper Minecraft server

Run Paper Run Paper is a Gradle plugin which adds a task to automatically download and run a Paper Minecraft server along with your plugin built by Gr

Jul 23, 2022
Run Minecraft on the command line

HeadlessForge While headless Minecraft Clients aren't anything new, they come with a drawback. The Minecraft API is missing and you need to add all fu

Aug 7, 2022
Actions are things that run, with parameters. Serves as a common dependency for a variety of Cepi extensions.

Actions Actions that take in customizable paramaters, an optional target, and do things. Installation Download the jar from Releases OR compile it you

Jan 9, 2022
Android app with minimal UI to run snowflake pluggable transports proxy, based on library IPtProxy

Simple Kotlin app for testing IPtProxy's snowflake proxy on Android Essentially a button for starting and stopping a Snowflake Proxy with the default

Jun 26, 2022
Solid - A CLI that tries to cover a dry-run phase for liquibase database change management

solid a CLI that tries to cover a dry-run phase for liquibase database change ma

Jan 28, 2022
Android project setup files when developing apps from scratch. The codebase uses lates jetpack libraries and MVVM repository architecture for setting up high performance apps

Android architecture app Includes the following Android Respository architecture MVVM Jepack libraries Carousel view Kotlin Kotlin Flow and Livedata P

Mar 31, 2022
An awesome list that curates the best KMM libraries, tools and more.

Awesome KMM Kotlin Multiplatform Mobile (KMM) is an SDK designed to simplify creating cross-platform mobile applications. With the help of KMM, you ca

Aug 11, 2022
A personal project made using Jetpack Compose, Clean-MVVM architecture and other jetpack libraries

A basic CRUD for recording your personal credit and debit transactions. Made using Jetpack Compose, Clean-MVVM and other Jetpack libraries, incorporated with Unit Tests.

Jul 23, 2022
The most essential libraries for Kotlin Multiplatform development
The most essential libraries for Kotlin Multiplatform development

Essenty The most essential libraries for Kotlin Multiplatform development. Supported targets: android jvm js (IR and LEGACY) iosArm64, iosX64 watchosA

Aug 5, 2022
🔨 Template for easy hosting of your Java/Kotlin libraries on GitHub

?? kotlin-jvm-library-template Another template for easy hosting your Java/Kotlin libraries on GitHub. Features boilerplate for Kotlin/Java projects w

Jan 7, 2022
An awesome collaborative collection of Kotlin Multiplatform libraries

Awesome Kotlin Multiplatform Awesome Projects Updated 33 November 21, 2021 Contents Guides Dependency Injection Database NoSQL SQL Extension Reactive

Apr 25, 2022
Trikot / kotlin multiplatform libraries

Trikot / kotlin multiplatform libraries Table of contents Introduction Modules Samples License Introduction Trikot is a framework that helps building

Jul 19, 2022
Automatically empty the trash in all of your Plex libraries

Plex Auto Trash Automatically empty the trash in all of your Plex libraries. If you disable automatic trash emptying (and you probably should) trash s

Aug 11, 2022