QuickBlox 视频聊天在发布模式下构建 apk 后崩溃
Posted
技术标签:
【中文标题】QuickBlox 视频聊天在发布模式下构建 apk 后崩溃【英文标题】:QuickBlox Video Chat crashes after building apk in release mode 【发布时间】:2016-06-02 17:37:40 【问题描述】:我正在使用 QuickBlox api 在 android 应用程序之上构建视频会议解决方案。观察到 VC 在调试模式下生成 apk 时运行良好,但在发布模式下生成后失败。我对 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/clas-s-referenceholder.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
【问题讨论】:
【参考方案1】:经过我的大量研究找到了正确的解决方案。在你的 proguard 中添加一行
-keep class org.webrtc.** *;
【讨论】:
【参考方案2】:提供崩溃的完整堆栈跟踪以找出问题。如果应用程序仅在发布模式下崩溃似乎是 proguard 问题。尝试从 proguard 文件中删除 quickblox 软件包。
【讨论】:
还为 org.webrtc.* 包添加 --keep 注释以上是关于QuickBlox 视频聊天在发布模式下构建 apk 后崩溃的主要内容,如果未能解决你的问题,请参考以下文章