gpt4 book ai didi

android - 在真实设备中加载 sinch 库时出现不满意的链接错误

转载 作者:行者123 更新时间:2023-11-30 02:34:00 27 4
gpt4 key购买 nike

我正在按照 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)

这就是我启动消息服务的方式

`   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();
}
}
}

请帮忙。谢谢

最佳答案

据我所知

无法加载您的库

当尝试调用无法找到其实现的 native 时抛出。 http://developer.android.com/reference/java/lang/UnsatisfiedLinkError.html

请检查此链接 https://stackoverflow.com/a/22121375/1761003

请贴出一些代码以获得更好的回复

关于android - 在真实设备中加载 sinch 库时出现不满意的链接错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26865367/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com