Search code examples
androidquickblox

QuickBlox Video Chat crashes after building apk in release mode


I am using QuickBlox api to build a video conference solution on top of an android application. It is observed that VC works well when apk is generated in debug mode but fails after it is generated in release mode. I made changes to proguard rules and also toggled minifyEnabled=true/false but nothing helped.

Here is the app build.gradle file:

buildscript {
    repositories {
        maven { url 'https://maven.fabric.io/public' }
    }

    dependencies {
        classpath 'io.fabric.tools:gradle:1.+'
    }
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.3"
    packagingOptions {
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
    }

    defaultConfig {
        applicationId "XX.YYYYY"
        minSdkVersion 17
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
        multiDexEnabled = true
    }
    buildTypes {
        release {
            minifyEnabled true
            shrinkResources false
            debuggable true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
        debug {
            debuggable true
            minifyEnabled false
            shrinkResources false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }

    dexOptions {
        incremental true
        preDexLibraries true
        javaMaxHeapSize "2g"
    }
}

repositories {
    mavenCentral()
    maven { url "https://github.com/QuickBlox/quickblox-android-sdk-releases/raw/master/" }
    maven { url 'https://maven.fabric.io/public' }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    testCompile 'junit:junit:4.12'
    compile files('libs/commons-codec-1.9.jar')
    compile files('libs/httpmime-4.2.1.jar')
    compile('com.crashlytics.sdk.android:crashlytics:2.5.5@aar') {
        transitive = true;
    }
    compile("com.quickblox:quickblox-android-sdk-chat:2.5.1@aar") {
        transitive = true
    }
    compile 'com.android.support:appcompat-v7:23.4.0'
    compile 'com.android.support:design:23.4.0'
    compile 'com.android.support:cardview-v7:23.4.0'
    compile 'com.google.android.gms:play-services-gcm:8.4.0'
    compile 'com.google.android.gms:play-services-auth:8.4.0'
    compile 'com.google.android.gms:play-services-ads:8.4.0'
    compile 'com.android.support:recyclerview-v7:23.4.0'
    compile 'com.makeramen:roundedimageview:2.2.1'
    compile 'commons-validator:commons-validator:1.4.0'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'com.sothree.slidinguppanel:library:3.3.0'
    compile 'com.quickblox:quickblox-android-sdk-core:2.5.1@aar'
    compile 'com.quickblox:quickblox-android-sdk-videochat-webrtc:2.5.1@aar'
    compile 'com.astuetz:pagerslidingtabstrip:1.0.1@aar'
    compile 'com.android.support:support-v4:23.4.0'
}
apply plugin: 'com.google.gms.google-services'

and here is an excerpt from proguard file

#----quickblox-------------------
-keep class org.jivesoftware.smack.** { *; }
-keep class com.quickblox.** { *; }
-keep class * extends org.jivesoftware.smack { public *; }
-keep class org.jivesoftware.smack.** { public *; }
-keep class org.jivesoftware.smackx.** { public *; }
-keep class com.quickblox.** { public *; }
-keep class * extends org.jivesoftware.smack { public *; }
-keep class * implements org.jivesoftware.smack.debugger.SmackDebugger { public *; }

-dontwarn com.quickblox.**
-dontwarn org.jivesoftware.**

I have already looked up few answers but those did not help me.

Below is the error log at the time of initiation of Video Call:

> 07-05 00:57:30.216 13043-13043/XX.XX E/MediaPlayer: Should have
> subtitle controller already set 07-05 00:57:48.586 13043-20239/XX.XX
> E/rtc: #
> # Fatal error in ../../talk/app/webrtc/java/jni/classreferenceholder.cc, line 132
> # Check failed: !jni->ExceptionCheck()
> # error during FindClass: org/webrtc/VideoCapturerAndroid$NativeObserver
>                                                  # 07-05 00:57:48.591 13043-20239/XX.XXXX A/libc: Fatal signal 6 (SIGABRT), code -6 in tid
> 20239 (Thread-6176) 07-05 00:57:52.081 20288-20288/XX.XXXX
> E/MotionRecognitionManager: mSContextService = null 07-05 00:57:52.081
> 20288-20288/XX.XXXX E/MotionRecognitionManager: motionService =
> com.samsung.android.motion.IMotionRecognitionService$Stub$Proxy@6d9d290

Solution

  • After a lot of my research found correct solution. Add line in your proguard

    -keep class org.webrtc.** { *; }