I am using the latest Sinch SDK 3.9.14 and my app immediately crashes when it gets to building the Sinch client for the MessageService.
Here is the MessageService.java file that it crashes on at the startSinchClient method.
package com.downloadjackal.jackal.utils;
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;
import java.util.List;
public class MessageService extends Service implements SinchClientListener {
private static final String APP_KEY = "removed";
private static final String APP_SECRET = "removed";
private static final String ENVIRONMENT = "clientapi.sinch.com";
private final MessageServiceInterface serviceInterface = new MessageServiceInterface();
private SinchClient sinchClient = null;
private MessageClient messageClient = null;
private String currentUserId;
private Intent broadcastIntent = new Intent("com.downloadloadjackal.jackal.ui.MainActivity");
private LocalBroadcastManager broadcaster;
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
broadcaster = LocalBroadcastManager.getInstance(this);
//Get the current user ID from Parse
currentUserId = ParseUser.getCurrentUser().getObjectId();
if (currentUserId != null && !isSinchClientStarted()) {
startSinchClient(currentUserId);
} else if (currentUserId != null && isSinchClientStarted()) {
broadcastIntent.putExtra(ParseConstants.KEY_GENERAL_SUCCESS, true);
broadcaster.sendBroadcast(broadcastIntent);
}
return super.onStartCommand(intent, flags, startId);
}
public void startSinchClient(String userId) {
sinchClient = Sinch.getSinchClientBuilder()
.context(this)
.userId(userId)
.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(ParseConstants.KEY_GENERAL_SUCCESS, false);
broadcaster.sendBroadcast(broadcastIntent);
sinchClient = null;
}
@Override
public void onClientStarted(SinchClient client) {
broadcastIntent.putExtra(ParseConstants.KEY_GENERAL_SUCCESS, true);
broadcaster.sendBroadcast(broadcastIntent);
client.startListeningOnActiveConnection();
messageClient = client.getMessageClient();
}
@Override
public void onClientStopped(SinchClient client) {
sinchClient = null;
}
@Override
public void onRegistrationCredentialsRequired(SinchClient client, ClientRegistration clientRegistration) {
}
@Override
public void onLogMessage(int level, String area, String message) {
}
@Override
public IBinder onBind(Intent intent) {
return serviceInterface;
}
public void sendMessage(List<String> recipientUserIds, String textBody) {
if (messageClient != null) {
WritableMessage message = new WritableMessage(recipientUserIds, 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 interface for MessagingActivity
public class MessageServiceInterface extends Binder {
public void sendMessage(List<String> recipientUserIds, String textBody) {
MessageService.this.sendMessage(recipientUserIds, 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();
}
}
}
Here is what I get:
02/21 12:42:50: Launching app
No apk changes detected since last installation, skipping installation of C:\Users\Michael\AndroidStudioProjects\Jackal\app\build\outputs\apk\app-debug.apk
$ adb shell am force-stop com.downloadjackal.jackal
$ adb shell am start -n "com.downloadjackal.jackal/com.downloadjackal.jackal.ui.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -D
Connecting to com.downloadjackal.jackal
D/HyLog: I : /data/font/config/sfconfig.dat, No such file or directory (2)
D/HyLog: I : /data/font/config/dfactpre.dat, No such file or directory (2)
D/HyLog: I : /data/font/config/sfconfig.dat, No such file or directory (2)
W/ActivityThread: Application com.downloadjackal.jackal is waiting for the debugger on port 8100...
I/System.out: Sending WAIT chunk
I/dalvikvm: Debugger is active
I/System.out: Debugger has connected
I/System.out: waiting for debugger to settle...
I/System.out: waiting for debugger to settle...
I/System.out: waiting for debugger to settle...
Connected to the target VM, address: 'localhost:8603', transport: 'socket'
I/System.out: waiting for debugger to settle...
I/System.out: waiting for debugger to settle...
I/System.out: waiting for debugger to settle...
I/System.out: waiting for debugger to settle...
I/System.out: waiting for debugger to settle...
I/System.out: waiting for debugger to settle...
I/System.out: waiting for debugger to settle...
I/System.out: debugger has settled (1498)
I/InstantRun: Instant Run Runtime started. Android package is com.downloadjackal.jackal, real application class is com.downloadjackal.jackal.JackalApplication.
W/InstantRun: No instant run dex files added to classpath
I/dalvikvm: Could not find method android.view.Window$Callback.onProvideKeyboardShortcuts, referenced from method android.support.v7.view.WindowCallbackWrapper.onProvideKeyboardShortcuts
W/dalvikvm: VFY: unable to resolve interface method 19778: Landroid/view/Window$Callback;.onProvideKeyboardShortcuts (Ljava/util/List;Landroid/view/Menu;I)V
D/dalvikvm: VFY: replacing opcode 0x72 at 0x0002
W/dalvikvm: VFY: unable to find class referenced in signature (Landroid/view/SearchEvent;)
I/dalvikvm: Could not find method android.view.Window$Callback.onSearchRequested, referenced from method android.support.v7.view.WindowCallbackWrapper.onSearchRequested
W/dalvikvm: VFY: unable to resolve interface method 19780: Landroid/view/Window$Callback;.onSearchRequested (Landroid/view/SearchEvent;)Z
D/dalvikvm: VFY: replacing opcode 0x72 at 0x0002
I/dalvikvm: Could not find method android.view.Window$Callback.onWindowStartingActionMode, referenced from method android.support.v7.view.WindowCallbackWrapper.onWindowStartingActionMode
W/dalvikvm: VFY: unable to resolve interface method 19784: Landroid/view/Window$Callback;.onWindowStartingActionMode (Landroid/view/ActionMode$Callback;I)Landroid/view/ActionMode;
D/dalvikvm: VFY: replacing opcode 0x72 at 0x0002
I/dalvikvm: Could not find method android.content.res.TypedArray.getChangingConfigurations, referenced from method android.support.v7.widget.TintTypedArray.getChangingConfigurations
W/dalvikvm: VFY: unable to resolve virtual method 922: Landroid/content/res/TypedArray;.getChangingConfigurations ()I
D/dalvikvm: VFY: replacing opcode 0x6e at 0x0002
I/dalvikvm: Could not find method android.content.res.TypedArray.getType, referenced from method android.support.v7.widget.TintTypedArray.getType
W/dalvikvm: VFY: unable to resolve virtual method 944: Landroid/content/res/TypedArray;.getType (I)I
D/dalvikvm: VFY: replacing opcode 0x6e at 0x0008
I/KeyHash:: iR5JKFv5hxh+BMDk07g0gnW37Nw=
I/AppCompatViewInflater: app:theme is now deprecated. Please move to using android:theme instead.
I/dalvikvm: Could not find method android.content.Context.getColorStateList, referenced from method android.support.v7.content.res.AppCompatResources.getColorStateList
W/dalvikvm: VFY: unable to resolve virtual method 589: Landroid/content/Context;.getColorStateList (I)Landroid/content/res/ColorStateList;
D/dalvikvm: VFY: replacing opcode 0x6e at 0x0006
I/dalvikvm: Could not find method android.content.res.Resources.getDrawable, referenced from method android.support.v7.widget.ResourcesWrapper.getDrawable
W/dalvikvm: VFY: unable to resolve virtual method 885: Landroid/content/res/Resources;.getDrawable (ILandroid/content/res/Resources$Theme;)Landroid/graphics/drawable/Drawable;
D/dalvikvm: VFY: replacing opcode 0x6e at 0x0002
I/dalvikvm: Could not find method android.content.res.Resources.getDrawableForDensity, referenced from method android.support.v7.widget.ResourcesWrapper.getDrawableForDensity
W/dalvikvm: VFY: unable to resolve virtual method 887: Landroid/content/res/Resources;.getDrawableForDensity (IILandroid/content/res/Resources$Theme;)Landroid/graphics/drawable/Drawable;
D/dalvikvm: VFY: replacing opcode 0x6e at 0x0002
E/dalvikvm: Could not find class 'android.graphics.drawable.RippleDrawable', referenced from method android.support.v7.widget.AppCompatImageHelper.hasOverlappingRendering
W/dalvikvm: VFY: unable to resolve instanceof 186 (Landroid/graphics/drawable/RippleDrawable;) in Landroid/support/v7/widget/AppCompatImageHelper;
D/dalvikvm: VFY: replacing opcode 0x20 at 0x000c
I/dalvikvm: Could not find method android.content.pm.PackageManager.getPackageInstaller, referenced from method com.google.android.gms.common.zzg.zzz
W/dalvikvm: VFY: unable to resolve virtual method 838: Landroid/content/pm/PackageManager;.getPackageInstaller ()Landroid/content/pm/PackageInstaller;
D/dalvikvm: VFY: replacing opcode 0x6e at 0x0013
I/dalvikvm: DexOpt: illegal method access (call Landroid/support/v7/app/ActionBarDrawerToggle;.<init> (Landroid/app/Activity;Landroid/support/v7/widget/Toolbar;Landroid/support/v4/widget/DrawerLayout;Landroid/support/v7/graphics/drawable/DrawerArrowDrawable;II)V from Lcom/downloadjackal/jackal/ui/NavigationDrawerFragment$7;)
I/dalvikvm: Could not find method android.support.v7.app.ActionBarDrawerToggle.<init>, referenced from method com.downloadjackal.jackal.ui.NavigationDrawerFragment$7.<init>
W/dalvikvm: VFY: unable to resolve direct method 12407: Landroid/support/v7/app/ActionBarDrawerToggle;.<init> (Landroid/app/Activity;Landroid/support/v7/widget/Toolbar;Landroid/support/v4/widget/DrawerLayout;Landroid/support/v7/graphics/drawable/DrawerArrowDrawable;II)V
D/dalvikvm: VFY: replacing opcode 0x76 at 0x0092
W/com.facebook.appevents.AppEventsLogger: activateApp events are being logged automatically. There's no need to call activateApp explicitly, this is safe to remove.
W/Settings: Setting airplane_mode_on has moved from android.provider.Settings.System to android.provider.Settings.Global, returning read-only value.
D/dalvikvm: DexOpt: couldn't find static field Landroid/os/Build;.SUPPORTED_ABIS
W/dalvikvm: VFY: unable to resolve static field 159 (SUPPORTED_ABIS) in Landroid/os/Build;
D/dalvikvm: VFY: replacing opcode 0x62 at 0x0006
D/dalvikvm: DexOpt: couldn't find static field Landroid/os/Build;.SUPPORTED_ABIS
I/dalvikvm: DexOpt: unable to optimize static field ref 0x009f at 0x0b in Lcom/sinch/relinker/SystemLibraryLoader;.supportedAbis
D/ReLinkerLibraryLoader: Beginning load of sinch-android-rtc...
D/dalvikvm: Trying to load lib /data/app-lib/com.downloadjackal.jackal-2/libsinch-android-rtc.so 0x41bf8050
D/dalvikvm: Added shared lib /data/app-lib/com.downloadjackal.jackal-2/libsinch-android-rtc.so 0x41bf8050
D/ReLinkerLibraryLoader: sinch-android-rtc (3.9.14) was loaded normally!
W/dalvikvm: JNI WARNING: JNI function GetMethodID called with exception pending
W/dalvikvm: in Lcom/sinch/android/rtc/internal/natives/jni/ServiceProviderFactory;.createServiceProvider:(Lcom/sinch/android/rtc/internal/service/dispatcher/Dispatcher;Lcom/sinch/android/rtc/internal/service/http/HttpService;Lcom/sinch/android/rtc/internal/service/pubnub/PubSubClient;Lcom/sinch/android/rtc/internal/service/crypto/CryptoService;Lcom/sinch/android/rtc/internal/service/persistence/PersistenceService;)Lcom/sinch/android/rtc/internal/natives/jni/NativeServiceProviderImpl; (GetMethodID)
W/dalvikvm: Pending exception is:
I/dalvikvm: java.lang.NoSuchMethodError: no method with name='encrypt' signature='(I[BLjava/lang/String;)Ljava/lang/String;' in class Lcom/sinch/android/rtc/internal/service/persistence/DefaultPersistenceService;
I/dalvikvm: at com.sinch.android.rtc.internal.natives.jni.ServiceProviderFactory.createServiceProvider(Native Method)
I/dalvikvm: at com.sinch.android.rtc.internal.service.serviceprovider.DefaultServiceProvider.<init>((null):-1)
I/dalvikvm: at com.sinch.android.rtc.internal.client.DefaultSinchClient.<init>((null):-1)
I/dalvikvm: at com.sinch.android.rtc.internal.client.InternalSinchClientFactory.createSinchClient((null):-1)
I/dalvikvm: at com.sinch.android.rtc.DefaultSinchClientBuilder.build((null):-1)
I/dalvikvm: at com.downloadjackal.jackal.utils.MessageService.startSinchClient(MessageService.java:55)
I/dalvikvm: at com.downloadjackal.jackal.utils.MessageService.onStartCommand(MessageService.java:40)
I/dalvikvm: at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2714)
I/dalvikvm: at android.app.ActivityThread.access$2100(ActivityThread.java:142)
I/dalvikvm: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1300)
I/dalvikvm: at android.os.Handler.dispatchMessage(Handler.java:102)
I/dalvikvm: at android.os.Looper.loop(Looper.java:136)
I/dalvikvm: at android.app.ActivityThread.main(ActivityThread.java:5118)
I/dalvikvm: at java.lang.reflect.Method.invokeNative(Native Method)
I/dalvikvm: at java.lang.reflect.Method.invoke(Method.java:515)
I/dalvikvm: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:790)
I/dalvikvm: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:606)
I/dalvikvm: at dalvik.system.NativeStart.main(Native Method)
I/dalvikvm: "main" prio=5 tid=1 NATIVE
I/dalvikvm: | group="main" sCount=0 dsCount=0 obj=0x41608f90 self=0x4150c9d8
I/dalvikvm: | sysTid=25755 nice=0 sched=0/0 cgrp=apps handle=1073946964
I/dalvikvm: | state=R schedstat=( 1783169453 1123951187 11498 ) utm=139 stm=39 core=0
A/libc: Fatal signal 11 (SIGSEGV) at 0x00000023 (code=1), thread 25755 (adjackal.jackal)
Disconnected from the target VM, address: 'localhost:8603', transport: 'socket'
User contributions licensed under CC BY-SA 3.0