我使用Sinch Android SDK进行即时消息传递。 我发送消息时收到以下错误,错误发生在" onIncomingMessage"听众被称为。
我使用Nexus 5,5.1.1和Sinch 3.6.2版,谢谢。
logcat的:
08-10 17:48:00.853 4933-5484/com.my.package A/libc? Fatal signal 11 (SIGSEGV), code 1, fault addr 0x29a in tid 5484 (Thread-14334)
08-10 17:48:00.958 187-187/? I/DEBUG? *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
08-10 17:48:00.958 187-187/? I/DEBUG? Build fingerprint: 'google/hammerhead/hammerhead:5.1.1/LMY48B/1863243:user/release-keys'
08-10 17:48:00.960 187-187/? I/DEBUG? Revision: '11'
08-10 17:48:00.960 187-187/? I/DEBUG? ABI: 'arm'
08-10 17:48:00.963 187-187/? I/DEBUG? pid: 4933, tid: 5484, name: Thread-14334 >>> com.my.package <<<
08-10 17:48:00.964 187-187/? I/DEBUG? signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x29a
08-10 17:48:01.004 187-187/? I/DEBUG? r0 0000029a r1 9af0bded r2 00000054 r3 00000007
08-10 17:48:01.004 187-187/? I/DEBUG? r4 9a9704d0 r5 9a970460 r6 9a970480 r7 9a970620
08-10 17:48:01.004 187-187/? I/DEBUG? r8 9a9704ec r9 9a9703d0 sl aefa84e0 fp aefa84e0
08-10 17:48:01.004 187-187/? I/DEBUG? ip 9af9ad70 sp 9a970388 lr 9ad215a5 pc b6df7372 cpsr 200b0030
08-10 17:48:01.004 187-187/? I/DEBUG? backtrace:
08-10 17:48:01.004 187-187/? I/DEBUG? #00 pc 00014372 /system/lib/libc.so (strcpy+5)
08-10 17:48:01.004 187-187/? I/DEBUG? #01 pc 001a85a1 /data/app/com.my.package-2/lib/arm/libsinch-android-rtc.so
08-10 17:48:01.004 187-187/? I/DEBUG? #02 pc 0025e2cc /data/app/com.my.package-2/lib/arm/libsinch-android-rtc.so
08-10 17:48:01.005 187-187/? I/DEBUG? #03 pc 0026801c /data/app/com.my.package-2/lib/arm/libsinch-android-rtc.so
08-10 17:48:01.005 187-187/? I/DEBUG? #04 pc 0026a640 /data/app/com.my.package-2/lib/arm/libsinch-android-rtc.so
08-10 17:48:01.005 187-187/? I/DEBUG? #05 pc 00245f54 /data/app/com.my.package-2/lib/arm/libsinch-android-rtc.so
08-10 17:48:01.005 187-187/? I/DEBUG? #06 pc 00243f50 /data/app/com.my.package-2/lib/arm/libsinch-android-rtc.so
08-10 17:48:01.005 187-187/? I/DEBUG? #07 pc 00245314 /data/app/com.my.package-2/lib/arm/libsinch-android-rtc.so
08-10 17:48:01.005 187-187/? I/DEBUG? #08 pc 00245480 /data/app/com.my.package-2/lib/arm/libsinch-android-rtc.so
08-10 17:48:01.005 187-187/? I/DEBUG? #09 pc 001ebb40 /data/app/com.my.package-2/lib/arm/libsinch-android-rtc.so
08-10 17:48:01.005 187-187/? I/DEBUG? #10 pc 001ed6c8 /data/app/com.my.package-2/lib/arm/libsinch-android-rtc.so
08-10 17:48:01.005 187-187/? I/DEBUG? #11 pc 001ec63c /data/app/com.my.package-2/lib/arm/libsinch-android-rtc.so
08-10 17:48:01.005 187-187/? I/DEBUG? #12 pc 001ee064 /data/app/com.my.package-2/lib/arm/libsinch-android-rtc.so
08-10 17:48:01.005 187-187/? I/DEBUG? #13 pc 001ef8c0 /data/app/com.my.package-2/lib/arm/libsinch-android-rtc.so
08-10 17:48:01.005 187-187/? I/DEBUG? #14 pc 002d0e2c /data/app/com.my.package-2/lib/arm/libsinch-android-rtc.so
08-10 17:48:01.005 187-187/? I/DEBUG? #15 pc 002d1354 /data/app/com.my.package-2/lib/arm/libsinch-android-rtc.so
08-10 17:48:01.005 187-187/? I/DEBUG? #16 pc 001abf07 /data/app/com.my.package-2/lib/arm/libsinch-android-rtc.so
08-10 17:48:01.005 187-187/? I/DEBUG? #17 pc 001af3dd /data/app/com.my.package-2/lib/arm/libsinch-android-rtc.so
08-10 17:48:01.005 187-187/? I/DEBUG? #18 pc 001af7e3 /data/app/com.my.package-2/lib/arm/libsinch-android-rtc.so
08-10 17:48:01.005 187-187/? I/DEBUG? #19 pc 001afb91 /data/app/com.my.package-2/lib/arm/libsinch-android-rtc.so
08-10 17:48:01.006 187-187/? I/DEBUG? #20 pc 001b0621 /data/app/com.my.package-2/lib/arm/libsinch-android-rtc.so
08-10 17:48:01.006 187-187/? I/DEBUG? #21 pc 001b31f5 /data/app/com.my.package-2/lib/arm/libsinch-android-rtc.so
08-10 17:48:01.006 187-187/? I/DEBUG? #22 pc 001aee55 /data/app/com.my.package-2/lib/arm/libsinch-android-rtc.so
08-10 17:48:01.006 187-187/? I/DEBUG? #23 pc 001b8701 /data/app/com.my.package-2/lib/arm/libsinch-android-rtc.so
08-10 17:48:01.006 187-187/? I/DEBUG? #24 pc 001b7f53 /data/app/com.my.package-2/lib/arm/libsinch-android-rtc.so
08-10 17:48:01.006 187-187/? I/DEBUG? #25 pc 00016baf /system/lib/libc.so (__pthread_start(void*)+30)
08-10 17:48:01.006 187-187/? I/DEBUG? #26 pc 00014af3 /system/lib/libc.so (__start_thread+6)
08-10 17:48:02.271 187-187/? I/DEBUG? Tombstone written to: /data/tombstones/tombstone_01
08-10 17:48:02.271 752-5712/? W/ActivityManager? Process com.my.package has crashed too many times: killing!
08-10 17:48:02.271 752-5712/? W/ActivityManager? Force finishing activity 4 com.my.package/.ui.activities.messenger.MessengerActivity
08-10 17:48:02.271 752-822/? I/BootReceiver? Copying /data/tombstones/tombstone_01 to DropBox (SYSTEM_TOMBSTONE)
08-10 17:48:02.278 4933-4933/com.my.package I/Choreographer? Skipped 78 frames! The application may be doing too much work on its main thread.
08-10 17:48:02.308 752-5712/? W/ActivityManager? Force finishing activity 4 com.my.package/.ui.activities.myapp.myappActivity
08-10 17:48:02.323 752-5712/? W/ActivityManager? Wtf, activity ActivityRecord{3652e5b u0 com.my.package/.ui.activities.myapp.myappActivity t2536 f} in proc activity list not using proc ProcessRecord{1b40577f 4933:com.my.package/u0a179}?!?
08-10 17:48:02.323 752-5712/? W/ActivityManager? Wtf, activity ActivityRecord{d075827 u0 com.my.package/.ui.activities.messenger.MessengerActivity t2536 f} in proc activity list not using proc ProcessRecord{1b40577f 4933:com.my.package/u0a179}?!?
08-10 17:48:02.323 178-178/? E/lowmemorykiller? Error writing /proc/4933/oom_score_adj; errno=22
08-10 17:48:02.329 752-5712/? I/ActivityManager? Killing 4933:com.my.package/u0a179 (adj 9): crash
08-10 17:48:02.386 752-766/? I/art? Background sticky concurrent mark sweep GC freed 134459(6MB) AllocSpace objects, 17(432KB) LOS objects, 13% free, 42MB/48MB, paused 2.489ms total 111.011ms
08-10 17:48:02.438 202-202/? I/Zygote? Process 4933 exited due to signal (11)
08-10 17:48:02.481 752-1308/? W/ActivityManager? Spurious death for ProcessRecord{1b40577f 4933:com.my.package/u0a179}, curProc for 4933: null
08-10 17:48:02.739 752-768/? W/InputMethodManagerService? Got RemoteException sending setActive(false) notification to pid 4933 uid 10179
08-10 17:48:02.742 1140-1140/? I/Keyboard.Facilitator? onFinishInput()
这是我使用的SinchService,我从sinch sdk样本中复制了它(sinch-rtc-sample-messaging):
package com.sinch.android.rtc.sample.messaging;
import android.app.Service;
import android.content.Intent;
import android.os.Binder;
import android.os.IBinder;
import android.util.Log;
import com.sinch.android.rtc.*;
import com.sinch.android.rtc.messaging.MessageClientListener;
import com.sinch.android.rtc.messaging.WritableMessage;
public class SinchService extends Service {
private static final String APP_KEY = "enter-application-key";
private static final String APP_SECRET = "enter-application-secret";
private static final String ENVIRONMENT = "sandbox.sinch.com";
private static final String TAG = SinchService.class.getSimpleName();
private final SinchServiceInterface mServiceInterface = new SinchServiceInterface();
private SinchClient mSinchClient = null;
private StartFailedListener mListener;
public class SinchServiceInterface extends Binder {
public boolean isStarted() {
return SinchService.this.isStarted();
}
public void startClient(String userName) {
start(userName);
}
public void stopClient() {
stop();
}
public void setStartListener(StartFailedListener listener) {
mListener = listener;
}
public void sendMessage(String recipientUserId, String textBody) {
SinchService.this.sendMessage(recipientUserId, textBody);
}
public void addMessageClientListener(MessageClientListener listener) {
SinchService.this.addMessageClientListener(listener);
}
public void removeMessageClientListener(MessageClientListener listener) {
SinchService.this.removeMessageClientListener(listener);
}
}
@Override
public void onCreate() {
super.onCreate();
}
@Override
public void onDestroy() {
if (mSinchClient != null && mSinchClient.isStarted()) {
mSinchClient.terminate();
}
super.onDestroy();
}
@Override
public IBinder onBind(Intent intent) {
return mServiceInterface;
}
private boolean isStarted() {
return (mSinchClient != null && mSinchClient.isStarted());
}
public void sendMessage(String recipientUserId, String textBody) {
if (isStarted()) {
WritableMessage message = new WritableMessage(recipientUserId, textBody);
mSinchClient.getMessageClient().send(message);
}
}
public void addMessageClientListener(MessageClientListener listener) {
if (mSinchClient != null) {
mSinchClient.getMessageClient().addMessageClientListener(listener);
}
}
public void removeMessageClientListener(MessageClientListener listener) {
if (mSinchClient != null) {
mSinchClient.getMessageClient().removeMessageClientListener(listener);
}
}
private void start(String userName) {
if (mSinchClient == null) {
mSinchClient = Sinch.getSinchClientBuilder().context(getApplicationContext()).userId(userName)
.applicationKey(APP_KEY)
.applicationSecret(APP_SECRET)
.environmentHost(ENVIRONMENT).build();
mSinchClient.setSupportMessaging(true);
;
mSinchClient.setSupportActiveConnectionInBackground(true);
mSinchClient.startListeningOnActiveConnection();
mSinchClient.addSinchClientListener(new MySinchClientListener());
mSinchClient.start();
}
}
private void stop() {
if (mSinchClient != null) {
mSinchClient.stopListeningOnActiveConnection();
mSinchClient.terminate();
mSinchClient = null;
}
}
public interface StartFailedListener {
void onStartFailed(SinchError error);
void onStarted();
}
private class MySinchClientListener implements SinchClientListener {
@Override
public void onClientFailed(SinchClient client, SinchError error) {
if (mListener != null) {
mListener.onStartFailed(error);
}
mSinchClient.terminate();
mSinchClient = null;
}
@Override
public void onClientStarted(SinchClient client) {
Log.d(TAG, "SinchClient started");
if (mListener != null) {
mListener.onStarted();
}
}
@Override
public void onClientStopped(SinchClient client) {
Log.d(TAG, "SinchClient stopped");
}
@Override
public void onLogMessage(int level, String area, String message) {
switch (level) {
case Log.DEBUG:
Log.d(area, message);
break;
case Log.ERROR:
Log.e(area, message);
break;
case Log.INFO:
Log.i(area, message);
break;
case Log.VERBOSE:
Log.v(area, message);
break;
case Log.WARN:
Log.w(area, message);
break;
}
}
@Override
public void onRegistrationCredentialsRequired(SinchClient client,
ClientRegistration clientRegistration) {
}
}
}