gpt4 book ai didi

java - UnsatisfiedLinkError : Couldn't load sinch-android-rtc from loader dalvik. 系统

转载 作者:行者123 更新时间:2023-11-29 05:16:52 24 4
gpt4 key购买 nike

我试图在手机上运行我的 android 应用程序时意外收到以下错误。基本上在应用程序中,它会调用消息服务,以便我能够运行我的即时消息。我正在使用 Sinch for android 来处理我的即时消息。

下面是日志猫消息:

10-08 00:34:31.550: E/AndroidRuntime(1610): FATAL EXCEPTION: main
10-08 00:34:31.550: E/AndroidRuntime(1610): Process: com.dooba.beta, PID: 1610
10-08 00:34:31.550: E/AndroidRuntime(1610): java.lang.UnsatisfiedLinkError: Couldn't load sinch-android-rtc from loader dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.dooba.beta-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.dooba.beta-1, /system/lib]]]: findLibrary returned null
10-08 00:34:31.550: E/AndroidRuntime(1610): at java.lang.Runtime.loadLibrary(Runtime.java:358)
10-08 00:34:31.550: E/AndroidRuntime(1610): at java.lang.System.loadLibrary(System.java:526)
10-08 00:34:31.550: E/AndroidRuntime(1610): at com.sinch.android.rtc.internal.natives.jni.UserAgentFactory.<clinit>(UserAgentFactory.java:9)
10-08 00:34:31.550: E/AndroidRuntime(1610): at com.sinch.android.rtc.internal.client.ServiceFactory.createUserAgent(ServiceFactory.java:44)
10-08 00:34:31.550: E/AndroidRuntime(1610): at com.sinch.android.rtc.internal.client.DefaultSinchClient.<init>(DefaultSinchClient.java:155)
10-08 00:34:31.550: E/AndroidRuntime(1610): at com.sinch.android.rtc.internal.client.InternalSinchClientFactory.createSinchClient(InternalSinchClientFactory.java:14)
10-08 00:34:31.550: E/AndroidRuntime(1610): at com.sinch.android.rtc.DefaultSinchClientBuilder.build(DefaultSinchClientBuilder.java:95)
10-08 00:34:31.550: E/AndroidRuntime(1610): at com.dooba.beta.MessageService.startSinchClient(MessageService.java:66)
10-08 00:34:31.550: E/AndroidRuntime(1610): at com.dooba.beta.MessageService.onStartCommand(MessageService.java:56)
10-08 00:34:31.550: E/AndroidRuntime(1610): at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2702)
10-08 00:34:31.550: E/AndroidRuntime(1610): at android.app.ActivityThread.access$2100(ActivityThread.java:135)
10-08 00:34:31.550: E/AndroidRuntime(1610): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1293)
10-08 00:34:31.550: E/AndroidRuntime(1610): at android.os.Handler.dispatchMessage(Handler.java:102)
10-08 00:34:31.550: E/AndroidRuntime(1610): at android.os.Looper.loop(Looper.java:136)
10-08 00:34:31.550: E/AndroidRuntime(1610): at android.app.ActivityThread.main(ActivityThread.java:5017)
10-08 00:34:31.550: E/AndroidRuntime(1610): at java.lang.reflect.Method.invokeNative(Native Method)
10-08 00:34:31.550: E/AndroidRuntime(1610): at java.lang.reflect.Method.invoke(Method.java:515)
10-08 00:34:31.550: E/AndroidRuntime(1610): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
10-08 00:34:31.550: E/AndroidRuntime(1610): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
10-08 00:34:31.550: E/AndroidRuntime(1610): at dalvik.system.NativeStart.main(Native Method)

下面是 MessageService Activity :

public class MessageService extends Service implements SinchClientListener {

private static final String APP_KEY = "xxxxx";
private static final String APP_SECRET = "xxxxx";
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.dooba.beta.MessagingActivity1");

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

如有任何帮助,我们将不胜感激。

更新添加库的屏幕

enter image description here

enter image description here

![在此处输入图片描述][3]

更新 3 enter image description here

10-09 18:27:08.450: E/AndroidRuntime(999): FATAL EXCEPTION: main
10-09 18:27:08.450: E/AndroidRuntime(999): java.lang.ExceptionInInitializerError
10-09 18:27:08.450: E/AndroidRuntime(999): at com.sinch.android.rtc.internal.client.ServiceFactory.createUserAgent(ServiceFactory.java:44)
10-09 18:27:08.450: E/AndroidRuntime(999): at com.sinch.android.rtc.internal.client.DefaultSinchClient.<init>(DefaultSinchClient.java:157)
10-09 18:27:08.450: E/AndroidRuntime(999): at com.sinch.android.rtc.internal.client.InternalSinchClientFactory.createSinchClient(InternalSinchClientFactory.java:14)
10-09 18:27:08.450: E/AndroidRuntime(999): at com.sinch.android.rtc.DefaultSinchClientBuilder.build(DefaultSinchClientBuilder.java:95)
10-09 18:27:08.450: E/AndroidRuntime(999): at com.dooba.beta.MessageService.startSinchClient(MessageService.java:56)
10-09 18:27:08.450: E/AndroidRuntime(999): at com.dooba.beta.MessageService.onStartCommand(MessageService.java:40)
10-09 18:27:08.450: E/AndroidRuntime(999): at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2490)
10-09 18:27:08.450: E/AndroidRuntime(999): at android.app.ActivityThread.access$1900(ActivityThread.java:130)
10-09 18:27:08.450: E/AndroidRuntime(999): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1292)
10-09 18:27:08.450: E/AndroidRuntime(999): at android.os.Handler.dispatchMessage(Handler.java:99)
10-09 18:27:08.450: E/AndroidRuntime(999): at android.os.Looper.loop(Looper.java:137)
10-09 18:27:08.450: E/AndroidRuntime(999): at android.app.ActivityThread.main(ActivityThread.java:4745)
10-09 18:27:08.450: E/AndroidRuntime(999): at java.lang.reflect.Method.invokeNative(Native Method)
10-09 18:27:08.450: E/AndroidRuntime(999): at java.lang.reflect.Method.invoke(Method.java:511)
10-09 18:27:08.450: E/AndroidRuntime(999): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
10-09 18:27:08.450: E/AndroidRuntime(999): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
10-09 18:27:08.450: E/AndroidRuntime(999): at dalvik.system.NativeStart.main(Native Method)
10-09 18:27:08.450: E/AndroidRuntime(999): Caused by: java.lang.UnsatisfiedLinkError: Couldn't load sinch-android-rtc: findLibrary returned null
10-09 18:27:08.450: E/AndroidRuntime(999): at java.lang.Runtime.loadLibrary(Runtime.java:365)
10-09 18:27:08.450: E/AndroidRuntime(999): at java.lang.System.loadLibrary(System.java:535)
10-09 18:27:08.450: E/AndroidRuntime(999): at com.sinch.android.rtc.internal.natives.jni.UserAgentFactory.<clinit>(UserAgentFactory.java:9)
[3]: http://i.stack.imgur.co

m/5Kx3e.png

最佳答案

您需要将 sinch 库复制到您的项目中,请参阅 sinch client for android documentation

下载the sinch android sdk zip , 将libs 文件夹中的内容复制到项目根目录下的libs 中。

清理并重建项目。在测试 apk 之前,以 zip 格式打开 apk 并确保 .so 文件位于 lib\*\ 文件夹中;

如果您在使用 Eclipse 正确打包应用程序时遇到问题,please consider using sinch's documentation and use android studio as they suggest

关于java - UnsatisfiedLinkError : Couldn't load sinch-android-rtc from loader dalvik. 系统,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26247986/

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