agraham Expert Licensed User Longtime User Jul 31, 2021 #1 Thanks to @DonManfred I can use trivial functions of a Kotlin compiled androidx library with JavaObject. Use androidx aar with JavaObject? | B4X Programming Forum However the library imports some Kotlin libraries Java: Copy import kotlin.Metadata; import kotlin.jvm.JvmOverloads; import kotlin.jvm.internal.DefaultConstructorMarker; import kotlin.jvm.internal.Intrinsics; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; and calling functions that use these imports results in errors like Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Lkotlin/jvm/internal/Intrinsics; Are the relevant libraries in the SDK and is there a way to persuade B4A to include them in the apk?
Thanks to @DonManfred I can use trivial functions of a Kotlin compiled androidx library with JavaObject. Use androidx aar with JavaObject? | B4X Programming Forum However the library imports some Kotlin libraries Java: Copy import kotlin.Metadata; import kotlin.jvm.JvmOverloads; import kotlin.jvm.internal.DefaultConstructorMarker; import kotlin.jvm.internal.Intrinsics; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; and calling functions that use these imports results in errors like Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Lkotlin/jvm/internal/Intrinsics; Are the relevant libraries in the SDK and is there a way to persuade B4A to include them in the apk?
JordiCP Expert Licensed User Longtime User Jul 31, 2021 #2 I had to do something similar with a kotlin compiled android framework some months ago. Most of the classes (at least in my case) were included in a couple of jars, so I downloaded them, added to the additional Libraries folder, and referenced with #AdditionalJar https://mvnrepository.com/artifact/org.jetbrains.kotlin/kotlin-stdlib Code: Copy #AdditionalJar: kotlin-stdlib-1.4.32 #AdditionalJar: kotlin-stdlib-jdk8-1.4.32 If it gives you errors (unsupported class file version 53.0), try with kotlin-stdlib-1.3.21 and kotlin-stdlib-jdk7-1.3.21 Upvote 0
I had to do something similar with a kotlin compiled android framework some months ago. Most of the classes (at least in my case) were included in a couple of jars, so I downloaded them, added to the additional Libraries folder, and referenced with #AdditionalJar https://mvnrepository.com/artifact/org.jetbrains.kotlin/kotlin-stdlib Code: Copy #AdditionalJar: kotlin-stdlib-1.4.32 #AdditionalJar: kotlin-stdlib-jdk8-1.4.32 If it gives you errors (unsupported class file version 53.0), try with kotlin-stdlib-1.3.21 and kotlin-stdlib-jdk7-1.3.21
agraham Expert Licensed User Longtime User Jul 31, 2021 #3 Yess! Many thanks for the suggestion I already saw that there is a kotlin folder in the SDK under tools\lib\external\org\jetbrains\kotlin with the 1.3.72 version of those two files file so, per your suggestion, I copied them to my additional libraries folder, referenced them with #AdditionalJar and that seems to work so far I wonder if there is a way to get the B4A IDE to use them without copying. Upvote 0
Yess! Many thanks for the suggestion I already saw that there is a kotlin folder in the SDK under tools\lib\external\org\jetbrains\kotlin with the 1.3.72 version of those two files file so, per your suggestion, I copied them to my additional libraries folder, referenced them with #AdditionalJar and that seems to work so far I wonder if there is a way to get the B4A IDE to use them without copying.
svanneste Member Licensed User Jul 31, 2021 #4 @agraham : maybe batch creating symbolic links to the referenced files ? With a script like that one : -> https://stackoverflow.com/questions...ch-script-in-windows#comment33963244_22322934 Upvote 0
@agraham : maybe batch creating symbolic links to the referenced files ? With a script like that one : -> https://stackoverflow.com/questions...ch-script-in-windows#comment33963244_22322934
agraham Expert Licensed User Longtime User Jul 31, 2021 #5 No. I meant for the IDE to include them from the SDK without hacking around. The copying is a once only task anyway so there is no point in scripting it. Upvote 0
No. I meant for the IDE to include them from the SDK without hacking around. The copying is a once only task anyway so there is no point in scripting it.
Erel B4X founder Staff member Licensed User Longtime User Aug 1, 2021 #6 Relevant tutorial: https://www.b4x.com/android/forum/t...stom-view-written-with-kotlin.104105/#content (versions might be outdated). There is nothing special with those jars. You should include them together with your library jar and use @DependsOn or manifest.txt to reference them. Upvote 0
Relevant tutorial: https://www.b4x.com/android/forum/t...stom-view-written-with-kotlin.104105/#content (versions might be outdated). There is nothing special with those jars. You should include them together with your library jar and use @DependsOn or manifest.txt to reference them.