- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
我已经集成了 Quick Blox Chat SDK 版本 3.8.1(最新版本于 2018 年 9 月 25 日可用)。我已经成功集成了聊天SDK。我面临的问题是应用程序在首次打开时崩溃并出现以下错误。
java.lang.RuntimeException: An error occurred while executing doInBackground()
at android.os.AsyncTask$3.done(AsyncTask.java:353)
at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:383)
at java.util.concurrent.FutureTask.setException(FutureTask.java:252)
at java.util.concurrent.FutureTask.run(FutureTask.java:271)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
at java.lang.Thread.run(Thread.java:764)
Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/common/internal/zzbq;
at com.google.android.gms.gcm.Task$Builder.checkConditions(Unknown Source:10)
at com.google.android.gms.gcm.OneoffTask$Builder.checkConditions(Unknown Source:0)
at com.google.android.gms.gcm.OneoffTask$Builder.build(Unknown Source:0)
at com.quickblox.messages.services.SubscribeTaskManager.a(Unknown Source:49)
at com.quickblox.messages.services.SubscribeService.c(Unknown Source:22)
at com.quickblox.messages.services.SubscribeService.a(Unknown Source:145)
at com.quickblox.messages.services.SubscribeService.a(Unknown Source:125)
at com.quickblox.messages.services.SubscribeService.e(Unknown Source:12)
at com.quickblox.messages.services.SubscribeService.b(Unknown Source:18)
at com.quickblox.messages.services.SubscribeService.onHandleWork(Unknown Source:46)
at android.support.v4.app.JobIntentService$CommandProcessor.doInBackground(JobIntentService.java:392)
at android.support.v4.app.JobIntentService$CommandProcessor.doInBackground(JobIntentService.java:383)
at android.os.AsyncTask$2.call(AsyncTask.java:333)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
at java.lang.Thread.run(Thread.java:764)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.common.internal.zzbq" on path: DexPathList[[zip file "/data/app/-HWe3wDorvDDaXln_aZyI2g==/base.apk"],nativeLibraryDirectories=[/data/app/HWe3wDorvDDaXln_aZyI2g==/lib/x86, /data/app/HWe3wDorvDDaXln_aZyI2g==/base.apk!/lib/x86, /system/lib, /vendor/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:125)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at com.google.android.gms.gcm.Task$Builder.checkConditions(Unknown Source:10)
at com.google.android.gms.gcm.OneoffTask$Builder.checkConditions(Unknown Source:0)
at com.google.android.gms.gcm.OneoffTask$Builder.build(Unknown Source:0)
at com.quickblox.messages.services.SubscribeTaskManager.a(Unknown Source:49)
at com.quickblox.messages.services.SubscribeService.c(Unknown Source:22)
at com.quickblox.messages.services.SubscribeService.a(Unknown Source:145)
at com.quickblox.messages.services.SubscribeService.a(Unknown Source:125)
at com.quickblox.messages.services.SubscribeService.e(Unknown Source:12)
at com.quickblox.messages.services.SubscribeService.b(Unknown Source:18)
at com.quickblox.messages.services.SubscribeService.onHandleWork(Unknown Source:46)
at android.support.v4.app.JobIntentService$CommandProcessor.doInBackground(JobIntentService.java:392)
at android.support.v4.app.JobIntentService$CommandProcessor.doInBackground(JobIntentService.java:383)
at android.os.AsyncTask$2.call(AsyncTask.java:333)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
at java.lang.Thread.run(Thread.java:764)
在集成聊天 SDK 之前,应用程序运行良好,没有任何问题。所以我坚信问题是由聊天 SDK 引起的。
注意事项
Mutidex 已启用
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'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.myapp"
minSdkVersion 21
targetSdkVersion 28
multiDexEnabled true
versionCode 1
versionName "1.0 - Alpha Dev version"
javaCompileOptions {
annotationProcessorOptions {
arguments = ["room.schemaLocation": "$projectDir/schemas".toString()]
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dataBinding {
enabled = true
}
dexOptions {
javaMaxHeapSize "4g"
}
}
dependencies {
def paging_version = "1.0.1"
def material = "1.0.0-rc01"
def qbSdkVersion = '3.8.1'
def swipyVersion = '1.2.3'
def stickylistheadersVersion = '0.4.2'
def androidSupport = '28.0.0'
def androidArch = '1.1.1'
def playService = '15.0.1'
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "com.android.support:appcompat-v7:$androidSupport"
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation "com.android.support:design:$androidSupport"
implementation 'com.google.firebase:firebase-crash:16.2.0'
implementation "android.arch.lifecycle:extensions:$androidArch"
implementation "android.arch.lifecycle:viewmodel:$androidArch"
implementation "android.arch.persistence.room:runtime:$androidArch"
annotationProcessor "android.arch.persistence.room:compiler:$androidArch"
implementation "com.google.android.gms:play-services-location:$playService"
implementation "com.google.android.gms:play-services-places:$playService"
implementation "com.google.firebase:firebase-core:16.0.3"
implementation 'com.google.firebase:firebase-messaging:17.3.2'
implementation 'com.nineoldandroids:library:2.4.0'
implementation 'com.daimajia.slider:library:1.1.5@aar'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'pub.devrel:easypermissions:1.2.0' /*permission simplified*/
implementation 'com.github.jrvansuita:PickImage:2.2.3'/*Image picker Camera/Gallery*/
implementation 'com.theartofdev.edmodo:android-image-cropper:2.7.0' /*Image cropper*/
implementation 'com.wdullaer:materialdatetimepicker:3.6.3' /*Date picker*/
implementation 'com.kofigyan.stateprogressbar:stateprogressbar:1.0.0'
implementation('com.github.ganfra:material-spinner:2.0.0') {
exclude group: 'com.android.support', module: 'appcompat-v7'
}
implementation 'com.squareup.retrofit2:retrofit:2.4.0'
implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
implementation 'com.facebook.android:facebook-android-sdk:4.34.0'
implementation 'com.github.danimahardhika:cafebar:1.3.1'/*Snack Toast SDK*/
implementation(name: 'sinch-android-verification-1.5.1', ext: 'aar') /*SMS verification*/
implementation 'com.github.blocoio:faker:1.2.7' /*Data faker*/
implementation 'com.github.joielechong:countrycodepicker:2.1.8'
implementation 'com.yarolegovich:sliding-root-nav:1.1.0' /*Custom nav drawer*/
implementation "com.yuyakaido.android:card-stack-view:1.0.0-beta9" /*Card stack view*/
implementation 'com.jaredrummler:android-animations:1.0.0' /*View Animator*/
implementation 'com.facebook.fresco:fresco:1.10.0'
implementation 'com.github.Binary-Finery:Bungee:master-SNAPSHOT'/*Activity Translation*/
implementation 'com.github.ybq:Android-SpinKit:1.1.0' /*Loading animations*/
implementation 'com.github.thunder413:DateTimeUtils:1.0' /*Date converter utility*/
implementation(name: 'filepicker', ext: 'aar')
implementation(name: 'materialrangebar', ext: 'aar')
implementation 'com.github.warkiz.widget:indicatorseekbar:2.0.9'
implementation 'com.github.PuffoCyano:Range-Time-Picker-Dialog:v1.5' /*Multi time range picker*/
implementation('com.crashlytics.sdk.android:crashlytics:2.9.5@aar') {
transitive = true;
}
implementation "com.quickblox:quickblox-android-sdk-chat:$qbSdkVersion"
implementation "com.quickblox:quickblox-android-sdk-extensions:$qbSdkVersion"
implementation "com.quickblox:quickblox-android-sdk-messages:$qbSdkVersion"
implementation 'com.quickblox:chat-message-adapter:2.0'
implementation "com.github.orangegangsters:swipy:$swipyVersion@aar"
implementation "com.timehop.stickyheadersrecyclerview:library:$stickylistheadersVersion@aar"
}
apply plugin: 'com.google.gms.google-services'
让我解释一下应用程序崩溃的场景。
感谢任何帮助。
最佳答案
Since version 3.2 android SDK provides new feature - auto subscription to push notification out of the box. It means you don’t need bother how to get GCM or FCM token, create QBPushNotifications.createSubscription and what to do with received data in your code anymore.
实际上导致应用程序崩溃的原因是,您没有按照 Quickblox 的说明添加 GCM 依赖项。添加与您的其他播放服务 sdk 版本相同的 GCM 依赖项:
implementation "com.google.android.gms:play-services-gcm:$your_version"
这将删除 Caused by: java.lang.NoClassDefFoundError
关于android - Quick Blox Android 聊天 SDK (v3.8.1) - 启动 com.quickblox.messages.services.SubscribeTaskManager.a 时应用程序崩溃(未知来源 :49),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52517306/
我是一名优秀的程序员,十分优秀!