在发布模式下构建 apk 后 QuickBlox 视频聊天崩溃
QuickBlox Video Chat crashes after building apk in release mode
我正在使用 QuickBlox api 在 android 应用程序之上构建视频会议解决方案。观察到 VC 在 debug 模式下生成 apk 时效果很好,但在 release 模式下生成后失败。我更改了 proguard 规则并切换了 minifyEnabled=true/false 但没有任何帮助。
这是应用 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
提供崩溃的完整堆栈跟踪以找出问题。如果应用程序仅在发布模式下崩溃似乎是 proguard 问题。尝试从 proguard 文件中删除 quickblox 包。
经过大量研究,我找到了正确的解决方案。在你的混淆器中添加行
-keep class org.webrtc.** { *; }
我正在使用 QuickBlox api 在 android 应用程序之上构建视频会议解决方案。观察到 VC 在 debug 模式下生成 apk 时效果很好,但在 release 模式下生成后失败。我更改了 proguard 规则并切换了 minifyEnabled=true/false 但没有任何帮助。
这是应用 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
提供崩溃的完整堆栈跟踪以找出问题。如果应用程序仅在发布模式下崩溃似乎是 proguard 问题。尝试从 proguard 文件中删除 quickblox 包。
经过大量研究,我找到了正确的解决方案。在你的混淆器中添加行
-keep class org.webrtc.** { *; }