我在sinch教程网站上提供的示例消息传递教程中尝试了一个简单的应用程序。当我尝试运行消息服务时,我收到一个不满意的链接错误。我正在使用真实设备并收到此错误。
是 logcat
11-11 17:59:49.996: E/NativeCrypto(28765): ssl=0x5da485a8 cert_verify_callback x509_store_ctx=0x5f55cab0 arg=0x0
11-11 17:59:49.996: E/NativeCrypto(28765): ssl=0x5da485a8 cert_verify_callback calling verifyCertificateChain authMethod=RSA
11-11 17:59:51.576: E/AndroidRuntime(28765): FATAL EXCEPTION: main
11-11 17:59:51.576: E/AndroidRuntime(28765): java.lang.UnsatisfiedLinkError: Couldn't load sinch-android-rtc from loader dalvik.system.PathClassLoader[DexPathList[dexElements=[zip file "/data/app/com.andro_yce.dyad-2.apk"],nativeLibraryDirectories=[/data/app-lib/com.andro_yce.dyad-2, /vendor/lib, /system/lib]]]: findLibrary returned null
11-11 17:59:51.576: E/AndroidRuntime(28765): at java.lang.Runtime.loadLibrary(Runtime.java:359)
11-11 17:59:51.576: E/AndroidRuntime(28765): at java.lang.System.loadLibrary(System.java:514)
11-11 17:59:51.576: E/AndroidRuntime(28765): at com.sinch.android.rtc.internal.natives.jni.UserAgentFactory.<clinit>(UserAgentFactory.java:9)
11-11 17:59:51.576: E/AndroidRuntime(28765): at com.sinch.android.rtc.internal.client.ServiceFactory.createUserAgent(ServiceFactory.java:44)
11-11 17:59:51.576: E/AndroidRuntime(28765): at com.sinch.android.rtc.internal.client.DefaultSinchClient.<init>(DefaultSinchClient.java:157)
11-11 17:59:51.576: E/AndroidRuntime(28765): at com.sinch.android.rtc.internal.client.InternalSinchClientFactory.createSinchClient(InternalSinchClientFactory.java:14)
11-11 17:59:51.576: E/AndroidRuntime(28765): at com.sinch.android.rtc.DefaultSinchClientBuilder.build(DefaultSinchClientBuilder.java:95)
11-11 17:59:51.576: E/AndroidRuntime(28765): at com.andro_yce.dyad.MessageService.startSinchClient(MessageService.java:47)
11-11 17:59:51.576: E/AndroidRuntime(28765): at com.andro_yce.dyad.MessageService.onStartCommand(MessageService.java:37)
11-11 17:59:51.576: E/AndroidRuntime(28765): at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2819)
11-11 17:59:51.576: E/AndroidRuntime(28765): at android.app.ActivityThread.access$1900(ActivityThread.java:156)
11-11 17:59:51.576: E/AndroidRuntime(28765): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1437)
11-11 17:59:51.576: E/AndroidRuntime(28765): at android.os.Handler.dispatchMessage(Handler.java:99)
11-11 17:59:51.576: E/AndroidRuntime(28765): at android.os.Looper.loop(Looper.java:153)
11-11 17:59:51.576: E/AndroidRuntime(28765): at android.app.ActivityThread.main(ActivityThread.java:5311)
11-11 17:59:51.576: E/AndroidRuntime(28765): at java.lang.reflect.Method.invokeNative(Native Method)
11-11 17:59:51.576: E/AndroidRuntime(28765): at java.lang.reflect.Method.invoke(Method.java:511)
11-11 17:59:51.576: E/AndroidRuntime(28765): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:833)
11-11 17:59:51.576: E/AndroidRuntime(28765): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
11-11 17:59:51.576: E/AndroidRuntime(28765): at dalvik.system.NativeStart.main(Native Method)
这就是我启动messageservice的方式
` ParseUser currentUser = ParseUser.getCurrentUser();
Intent serviceIntent = new Intent(this, MessageService.class);
if (currentUser != null) {
startService(serviceIntent);
}
showSpinner();
private Intent broadcastIntent = new Intent("com.andro_yce.dyad.SplashActivity");
这是我的留言服务课程
package com.andro_yce.dyad;
import android.app.Service;
import android.content.Intent;
import android.os.Binder;
import android.os.IBinder;
import android.support.v4.content.LocalBroadcastManager;
import com.parse.ParseUser;
import com.sinch.android.rtc.ClientRegistration;
import com.sinch.android.rtc.Sinch;
import com.sinch.android.rtc.SinchClient;
import com.sinch.android.rtc.SinchClientListener;
import com.sinch.android.rtc.SinchError;
import com.sinch.android.rtc.messaging.MessageClient;
import com.sinch.android.rtc.messaging.MessageClientListener;
import com.sinch.android.rtc.messaging.WritableMessage;
public class MessageService extends Service implements SinchClientListener {
private static final String APP_KEY = "**********";
private static final String APP_SECRET = "==========";
private static final String ENVIRONMENT = "sandbox.sinch.com";
private final MessageServiceInterface serviceInterface = new MessageServiceInterface();
private SinchClient sinchClient = null;
private MessageClient messageClient = null;
private String currentUserId;
private LocalBroadcastManager broadcaster;
private Intent broadcastIntent = new Intent("com.andro_yce.dyad.SplashActivity");
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
currentUserId = ParseUser.getCurrentUser().getObjectId();
if (currentUserId != null && !isSinchClientStarted()) {
startSinchClient(currentUserId);
}
broadcaster = LocalBroadcastManager.getInstance(this);
return super.onStartCommand(intent, flags, startId);
}
public void startSinchClient(String username) {
sinchClient = Sinch.getSinchClientBuilder().context(this).userId(username).applicationKey(APP_KEY)
.applicationSecret(APP_SECRET).environmentHost(ENVIRONMENT).build();
sinchClient.addSinchClientListener(this);
sinchClient.setSupportMessaging(true);
// sinchClient.setSupportCalling(true);
sinchClient.setSupportActiveConnectionInBackground(true);
sinchClient.checkManifest();
sinchClient.start();
}
private boolean isSinchClientStarted() {
return sinchClient != null && sinchClient.isStarted();
}
@Override
public void onClientFailed(SinchClient client, SinchError error) {
broadcastIntent.putExtra("success", false);
broadcaster.sendBroadcast(broadcastIntent);
sinchClient = null;
}
@Override
public void onClientStarted(SinchClient client) {
broadcastIntent.putExtra("success", true);
broadcaster.sendBroadcast(broadcastIntent);
client.startListeningOnActiveConnection();
messageClient = client.getMessageClient();
}
@Override
public void onClientStopped(SinchClient client) {
sinchClient = null;
}
@Override
public IBinder onBind(Intent intent) {
return serviceInterface;
}
@Override
public void onLogMessage(int level, String area, String message) {
}
@Override
public void onRegistrationCredentialsRequired(SinchClient client, ClientRegistration clientRegistration) {
}
public void sendMessage(String recipientUserId, String textBody) {
if (messageClient != null) {
WritableMessage message = new WritableMessage(recipientUserId, textBody);
messageClient.send(message);
}
}
public void addMessageClientListener(MessageClientListener listener) {
if (messageClient != null) {
messageClient.addMessageClientListener(listener);
}
}
public void removeMessageClientListener(MessageClientListener listener) {
if (messageClient != null) {
messageClient.removeMessageClientListener(listener);
}
}
@Override
public void onDestroy() {
sinchClient.stopListeningOnActiveConnection();
sinchClient.terminate();
}
public class MessageServiceInterface extends Binder {
public void sendMessage(String recipientUserId, String textBody) {
MessageService.this.sendMessage(recipientUserId, textBody);
}
public void addMessageClientListener(MessageClientListener listener) {
MessageService.this.addMessageClientListener(listener);
}
public void removeMessageClientListener(MessageClientListener listener) {
MessageService.this.removeMessageClientListener(listener);
}
public boolean isSinchClientStarted() {
return MessageService.this.isSinchClientStarted();
}
}
}
请帮忙。感谢
答案 0 :(得分:1)
目前正如我所见
Your library couldn't be loaded
尝试调用无法找到实现的本机时抛出。 http://developer.android.com/reference/java/lang/UnsatisfiedLinkError.html
请查看此链接https://stackoverflow.com/a/22121375/1761003
请发布一些代码以便更好地回复