Skip to content
This repository has been archived by the owner on Aug 22, 2021. It is now read-only.

Exception in thread "main" java.lang.UnsatisfiedLinkError: dev.whyoleg.ktd.TelegramRawClient.create()J #57

Open
theapache64 opened this issue Apr 11, 2020 · 10 comments

Comments

@theapache64
Copy link

When I try to

import dev.whyoleg.ktd.Telegram
import dev.whyoleg.ktd.TelegramClientConfiguration
import kotlin.time.ExperimentalTime
import kotlin.time.seconds

@ExperimentalTime
suspend fun main() {

    val telegram = Telegram(
        configuration = TelegramClientConfiguration(
            maxEventsCount = 1000,
            receiveTimeout = 1.seconds //ms
        )
    )

    val client = telegram.client()
}

I am getting below error

Try to load tdlib as library
Exception in thread "main" java.lang.UnsatisfiedLinkError: dev.whyoleg.ktd.TelegramRawClient.create()J
	at dev.whyoleg.ktd.TelegramRawClient.create(Native Method)
	at dev.whyoleg.ktd.NativeClient.<init>(NativeClient.kt:8)
	at dev.whyoleg.ktd.Telegram.client(Telegram.kt:11)
	at MainKt.main(Main.kt:19)
	at MainKt$$$main.invoke(Unknown Source)
	at kotlin.coroutines.intrinsics.IntrinsicsKt__IntrinsicsJvmKt$createCoroutineUnintercepted$$inlined$createCoroutineFromSuspendFunction$IntrinsicsKt__IntrinsicsJvmKt$1.invokeSuspend(IntrinsicsJvm.kt:199)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	at kotlin.coroutines.ContinuationKt.startCoroutine(Continuation.kt:114)
	at kotlin.coroutines.jvm.internal.RunSuspendKt.runSuspend(RunSuspend.kt:19)
	at MainKt.main(Main.kt)

@whyoleg
Copy link
Owner

whyoleg commented Apr 11, 2020

Hi
Which version of lib do you use?
Also, is it android or jvm artifact used? Looks like it isn't latest release

@theapache64
Copy link
Author

JVM -> implementation "dev.whyoleg.ktd:ktd-api-coroutines-jvm:0.5.0-1.5.4" (which is given in the README)

@whyoleg
Copy link
Owner

whyoleg commented Apr 11, 2020

Ok, are you sure, that there is no tdjni native lib in default paths? It looks, like it's even don't try to load it from artifact. If there are no line Try to load tdlib from artifact then something goes wrong. (seems will be fixed in next release)

@theapache64
Copy link
Author

As I am running with Ubuntu 16.04 and the library's built-in tdjni not supporting this version of Ubuntu, I had to build the so file myself and store in the default path. Reference

@whyoleg
Copy link
Owner

whyoleg commented Apr 11, 2020

Hm, and how you built it?
You need to use cli module in that project to build it with right JNI bindings file, which is different from that, which is in tdlib examples

@theapache64
Copy link
Author

theapache64 commented Apr 11, 2020

I built the SO file using TDLib Build instruction generator, and that's working with the given Java example.

@whyoleg
Copy link
Owner

whyoleg commented Apr 11, 2020

So, it's why it doesn't work...
You need to run it sudo apt install make zlib1g-dev libssl-dev gperf libc++abi-dev libc++-dev ccache ninja-build -y
And then, checkout that repository, in cli module there is file App.kt
change method main, so it will contain one line parser().parse("tdlib -v 1.5.4 -p jvm -t linux".cmd())
It will built right .so file in tdlib/jni/bin

@theapache64
Copy link
Author

Okay, I'll give it a try.

@whyoleg
Copy link
Owner

whyoleg commented Apr 14, 2020

@theapache64 do you have any progress? May be some help needed?

@slavaatsig
Copy link

Also built the tdlib from instructions for the macOS and after I got the lib I've also go Can't find class [org/drinkless/tdlib/Client] error.

Any solution for the Catalina 10.15.7?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants