在发布模式下构建apk后,QuickBlox Video Chat崩溃

时间:2016-06-02 17:37:41

标签: android quickblox

我正在使用QuickBlox api在Android应用程序之上构建视频会议解决方案。可以看出,在调试模式下生成apk时VC运行良好,但在发布模式下生成后失败。我对proguard规则进行了更改,并且还切换了minifyEnabled = true / false,但没有任何帮助。

这是app build.gradle文件:

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'

以下是proguard文件的摘录

#----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.**

我已经找到了一些答案,但那些没有帮助我。

以下是视频通话开始时的错误日志:

> 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

2 个答案:

答案 0 :(得分:1)

经过我的大量研究找到了正确的解决方案。在你的 proguard 中添加一行

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

答案 1 :(得分:0)

从崩溃中提供完整的堆栈跟踪以找出问题。如果应用程序仅在发布模式下崩溃似乎就像它的proguard问题。尝试从proguard文件中删除quickblox包。