Hello, I wrote a Multiplatform testing library tha...
# android
d
Hello, I wrote a Multiplatform testing library that includes backticks named functions. I’ve packed and shipped via Bintray, I’ve included in tests of my Android project. Tests are running just well, but when I build the project I got:
Copy code
> Transform artifact assert4k-jvm-0.2.2.jar (studio.forface:assert4k-jvm:0.2.2) with DexingWithClasspathTransform
AGPBI: {"kind":"error","text":"Class descriptor 'Lassert4k/CollectionKt$is not$2;' cannot be represented in dex format.","sources":[{}],"tool":"D8"}

> Task :app:mergeExtDexBetaDebugAndroidTest FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:mergeExtDexBetaDebugAndroidTest'.
> Could not resolve all files for configuration ':app:betaDebugAndroidTestRuntimeClasspath'.
   > Failed to transform assert4k-jvm-0.2.2.jar (studio.forface:assert4k-jvm:0.2.2) to match attributes {artifactType=android-dex, dexing-enable-desugaring=true, dexing-is-debuggable=true, dexing-min-sdk=21, org.gradle.libraryelements=jar, org.gradle.status=release, org.gradle.usage=java-runtime, org.jetbrains.kotlin.platform.type=jvm}.
      > Execution failed for DexingWithClasspathTransform: /Users/davide/.gradle/caches/modules-2/files-2.1/studio.forface/assert4k-jvm/0.2.2/3c15ade7f5afff280c26ca8346b645c620f3af76/assert4k-jvm-0.2.2.jar.
         > Error while dexing.
Any idea?
c
backtick-named functions are really only for JVM tests. They’re usually not valid function names on Android or in JS (not sure about Native)
👍 1
d
Yes I know that, isn’t there any solution? I see also Kluent is using backticks
c
It’s a restriction of the runtime itself, there’s not much you can do. It’s not back-ticks itself that are the problem, its using illegal characters like spaces within the back-ticks. The Kotlin compiler is fine with spaces in a function name, but ART is not
d
Yes, I was wondering if it would be possibile to introduce some name mangling there 🙂
c
But then you start running into issues with things like reflection if it’s done automatically. Usage of
@JvmName
annotations might help though
d
Yes, that’s right, but the code would start become very ugly, it’s already full of
@JsName
😞 I don’t know how Kotlin is not managing that itself 😕
l
What are the specific characters that require you to use backticks?