Search code examples
javaandroid-studiounsatisfiedlinkerrortelegram

UnsatisfiedLinkError: Getting this error in Telegram project


I downloaded the Telegram project from GitHub and imported to Android Studio. The gradle is build without any error but when I run it I get UnsatisfiedLinkError error.

From logCat:

FATAL EXCEPTION: main Process: org.telegram.messenger.beta, PID: 11299 java.lang.UnsatisfiedLinkError: No implementation found for void org.telegram.tgnet.ConnectionsManager.native_setJava(boolean) (tried Java_org_telegram_tgnet_ConnectionsManager_native_1setJava and Java_org_telegram_tgnet_ConnectionsManager_native_1setJava__Z) at org.telegram.tgnet.ConnectionsManager.native_setJava(Native Method) at org.telegram.messenger.ApplicationLoader.onCreate(ApplicationLoader.java:278) at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1035) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4638) at android.app.ActivityThread.access$1500(ActivityThread.java:155) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1378) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:135) at android.app.ActivityThread.main(ActivityThread.java:5343) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:905) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:700)

And the line error points to is:

ConnectionsManager.native_setJava(android.os.Build.VERSION.SDK_INT == 14 || android.os.Build.VERSION.SDK_INT == 15);

Got stuck here for 2 days. Help me out. Thanks in advance.


Solution

  • Finally found the solution for it! The project has C and CPP files that needs libraries which is in .so extension while running in devices.Recently they have deleted those files which is added in the commit section.That is why we get an exception while running.So we have run these C and CPP codes using NDK and Cygwin.

    Download NDK: http://developer.android.com/intl/es/ndk/downloads/index.html

    Download Cygwin: https://www.cygwin.com/

    Removing prebuilt libraries. The source code for all libraries is (and always was) available here: https://github.com/DrKLO/Telegram/tree/master/TMessagesProj/jni