UnsatisfiedLinkError:在Telegram项目中获取此错误

时间:2015-12-29 08:21:07

标签: java android-studio unsatisfiedlinkerror telegram

我从GitHub下载了Telegram项目并导入到Android Studio。构建gradle时没有任何错误,但是当我运行它时出现UnsatisfiedLinkError错误。

来自logCat:

  

致命的例外:主要       过程:org.telegram.messenger.beta,PID:11299                                                           java.lang.UnsatisfiedLinkError:找不到void org.telegram.tgnet.ConnectionsManager.native_setJava(boolean)的实现(尝试过Java_org_telegram_tgnet_ConnectionsManager_native_1setJava和Java_org_telegram_tgnet_ConnectionsManager_native_1setJava__Z)                                                          at org.telegram.tgnet.ConnectionsManager.native_setJava(Native Method)                                                          在org.telegram.messenger.ApplicationLoader.onCreate(ApplicationLoader.java:278)                                                          在android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1035)                                                          在android.app.ActivityThread.handleBindApplication(ActivityThread.java:4638)                                                          在android.app.ActivityThread.access $ 1500(ActivityThread.java:155)                                                          在android.app.ActivityThread $ H.handleMessage(ActivityThread.java:1378)                                                          在android.os.Handler.dispatchMessage(Handler.java:102)                                                          在android.os.Looper.loop(Looper.java:135)                                                          在android.app.ActivityThread.main(ActivityThread.java:5343)                                                          at java.lang.reflect.Method.invoke(Native Method)                                                          在java.lang.reflect.Method.invoke(Method.java:372)                                                          在com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:905)                                                          在com.android.internal.os.ZygoteInit.main(ZygoteInit.java:700)

行错误指向:

  

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

在这里停留了2天。帮帮我。提前谢谢。

1 个答案:

答案 0 :(得分:4)

终于找到了解决方案! 该项目有C和CPP文件,需要在设备中运行时扩展reversePairs([X,Y|Xs], ReversedList) :- reversePairs([X,Y|Xs], [], ReversedList). reversePairs([], ReversedList, ReversedList). reversePairs([X,Y|Xs], Accum, ReversedList) :- reversePairs(Xs, [X,Y|Accum], ReversedList). 的库。最近他们删除了在提交部分添加的那些文件。这就是我们在运行时得到异常的原因。所以我们使用NDK和Cygwin运行这些C和CPP代码。

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

下载Cygwin: https://www.cygwin.com/

删除预建库。所有库的源代码都是(并且始终可用):https://github.com/DrKLO/Telegram/tree/master/TMessagesProj/jni