Crash log –
--------- beginning of crash
2023-03-03 15:33:10.259 11639-12705/AndroidRuntime: FATAL EXCEPTION: AsyncTask #1
Process: PID: 11639
java.lang.RuntimeException: An error occurred while executing doInBackground()
at android.os.AsyncTask$4.done(AsyncTask.java:415)
at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:381)
at java.util.concurrent.FutureTask.setException(FutureTask.java:250)
at java.util.concurrent.FutureTask.run(FutureTask.java:269)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1137)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637)
at java.lang.Thread.run(Thread.java:1012)
Caused by: java.lang.IllegalArgumentException: Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent.
Strongly consider using FLAG_IMMUTABLE, only use FLAG_MUTABLE if some functionality depends on the PendingIntent being mutable, e.g. if it needs to be used with inline replies or bubbles.
at android.app.PendingIntent.checkFlags(PendingIntent.java:402)
at android.app.PendingIntent.getBroadcastAsUser(PendingIntent.java:672)
at android.app.PendingIntent.getBroadcast(PendingIntent.java:659)
at com.google.android.gms.gcm.zzm.<init>(Unknown Source:17)
at com.google.android.gms.gcm.GcmNetworkManager.zzd(Unknown Source:28)
at com.google.android.gms.gcm.GcmNetworkManager.schedule(Unknown Source:8)
at com.quickblox.messages.services.SubscribeTaskManager.a(Unknown Source:58)
at com.quickblox.messages.services.SubscribeService.c(Unknown Source:24)
at com.quickblox.messages.services.SubscribeService.a(Unknown Source:150)
at com.quickblox.messages.services.SubscribeService.a(Unknown Source:136)
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:51)
at androidx.core.app.JobIntentService$CommandProcessor.doInBackground(JobIntentService.java:396)
at androidx.core.app.JobIntentService$CommandProcessor.doInBackground(JobIntentService.java:387)
at android.os.AsyncTask$3.call(AsyncTask.java:394)
at java.util.concurrent.FutureTask.run(FutureTask.java:264)
... 3 more
2023-03-03 15:33:10.263 1768-2337/? E/OplusNetworkStackManager: callback len = 6
Root build.gradle –
buildscript {
ext.kotlin_version = '1.8.0'
repositories {
google()
jcenter()
maven { url 'https://jitpack.io' }
maven {
url 'https://maven.fabric.io/public'
}
maven {
url "https://github.com/QuickBlox/quickblox-android-sdk-releases/raw/master/"
}
}
dependencies {
classpath 'com.android.tools.build:gradle:7.1.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.8'
classpath 'io.fabric.tools:gradle:1.28.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
flatDir {
dirs 'libs'
}
google()
jcenter()
maven { url 'https://jitpack.io' }
maven {
url 'https://maven.google.com/'
}
maven {
url "https://github.com/QuickBlox/quickblox-android-sdk-releases/raw/master/"
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
app:build.gradle –
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
//apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 33
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildFeatures {
viewBinding false
}
lintOptions {
checkReleaseBuilds false
}
defaultConfig {
applicationId ""
minSdkVersion 20
targetSdkVersion 31
versionCode 109
versionName "1.0.6"
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
multiDexEnabled true
vectorDrawables.useSupportLibrary = true
project.configurations.all {
resolutionStrategy {
force 'androidx.work:work-runtime-ktx:2.8.0'
}
}
}
repositories {
maven {
url "https://github.com/QuickBlox/quickblox-android-sdk-releases/raw/master/"
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
crunchPngs false // or true
}
}
}
//def qbSdkVersion = '3.7.0'
def work_version = "2.8.0"
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
// implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.vectordrawable:vectordrawable:1.0.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
implementation 'androidx.multidex:multidex:2.0.0'
// implementation "com.google.android.gms:play-services-base:16.1.0"
implementation 'androidx.multidex:multidex:2.0.0'
implementation 'com.google.android.gms:play-services-base:18.2.0'
constraints {
implementation('androidx.work:work-runtime:2.8.0') {
because 'play-services-ads depends on work-runtime:2.1.0 which is not compatible with targetSdk 31, but work-runtime:2.7.0 is'
}
}
implementation "com.google.android.gms:play-services-analytics:18.0.1"
constraints {
implementation('androidx.work:work-runtime:2.8.0') {
because 'play-services-ads depends on work-runtime:2.1.0 which is not compatible with targetSdk 31, but work-runtime:2.7.0 is'
}
}
implementation 'com.google.android.gms:play-services-wallet:19.1.0'
constraints {
implementation('androidx.work:work-runtime:2.8.0') {
because 'play-services-ads depends on work-runtime:2.1.0 which is not compatible with targetSdk 31, but work-runtime:2.7.0 is'
}
}
implementation 'androidx.appcompat:appcompat:1.7.0-alpha02'
implementation 'androidx.slice:slice-core:1.1.0-alpha02'
implementation 'androidx.slice:slice-builders:1.1.0-alpha02'
implementation 'androidx.recyclerview:recyclerview:1.2.1'
implementation 'com.squareup.retrofit2:retrofit:2.0.2'
implementation 'com.squareup.retrofit2:converter-gson:2.0.2'
implementation 'com.squareup.okhttp:okhttp:2.2.0'
implementation 'com.squareup.okhttp:okhttp-urlconnection:2.2.0'
implementation 'com.squareup.picasso:picasso:2.4.0'
implementation 'com.jakewharton.picasso:picasso2-okhttp3-downloader:1.1.0'
implementation "com.quickblox:quickblox-android-sdk-chat:3.9.2"
//include only necessary module dependency, all transitive modules will be included automatically
implementation "com.quickblox:quickblox-android-sdk-content:3.9.2"
implementation "com.quickblox:quickblox-android-sdk-messages:3.9.2"
implementation "com.quickblox:quickblox-android-sdk-customobjects:3.9.2"
implementation "com.quickblox:quickblox-android-sdk-core:3.9.2"
implementation "com.quickblox:quickblox-android-sdk-videochat-webrtc:3.9.2"
implementation "com.quickblox:quickblox-android-sdk-conference:3.9.2"
implementation 'com.mikhaellopez:circularimageview:3.2.0'
implementation 'com.github.stfalcon:chatkit:0.3.1'
implementation 'com.applandeo:material-calendar-view:1.5.1'
implementation 'com.braintreepayments:card-form:3.4.1'
implementation 'com.hlab.fabrevealmenu:fab-reveal-menu:1.0.3'
implementation 'com.github.arthurghazaryan:floatingactionmenu:1.0.0'
implementation 'com.labo.kaji:relativepopupwindow:0.3.1'
implementation 'com.github.douglasjunior:android-simple-tooltip:0.2.2'
implementation 'am.appwise.components:NoInternetDialog:1.1.3'
// implementation platform('com.google.firebase:firebase-bom')
implementation 'com.google.firebase:firebase-core:21.1.1'
implementation 'com.google.firebase:firebase-messaging:23.1.1'
implementation 'com.google.firebase:firebase-crashlytics:18.3.5'
implementation('com.google.firebase:firebase-iid:21.1.0')
// implementation platform('com.google.firebase:firebase-bom:31.1.0')
// implementation 'com.github.prolificinteractive:material-calendarview:2.0.0'
implementation 'com.github.jd-alexander:LikeButton:0.2.3'
implementation 'com.github.Kyash:android-target-instructions:0.1.4'
// implementation(name: 'sinch-android-rtc', version: '+', ext: 'aar')
implementation 'io.branch.sdk.android:library:3.+'
implementation 'com.github.joielechong:countrycodepicker:2.4.1'
implementation 'com.github.barteksc:android-pdf-viewer:2.8.2'
implementation 'es.voghdev.pdfviewpager:library:1.1.2'
implementation 'com.bogdwellers:pinchtozoom:0.1'
implementation 'org.ocpsoft.prettytime:prettytime:4.0.1.Final'
implementation 'org.webrtc:google-webrtc:1.0.22171'
implementation 'com.payumoney.sdkui:plug-n-play:1.6.1'
implementation 'com.google.android.play:core:1.10.3'
implementation 'com.github.javiersantos:BottomDialogs:1.2.1'
implementation 'com.github.jineshfrancs:CaptchaImageView:1.0'
implementation 'com.poovam:pin-edittext-field:1.2.3'
def billing_version = '5.1.0'
implementation "com.android.billingclient:billing:$billing_version"
implementation 'me.zhanghai.android.materialratingbar:library:1.4.0'
implementation 'com.github.angads25:toggle:1.1.0'
implementation 'com.github.barteksc:android-pdf-viewer:2.8.2'
implementation 'info.guardianproject.netcipher:netcipher:2.1.0'
// implementation 'androidx.work:work-runtime:2.8.0'
// implementation 'androidx.work:work-runtime-ktx:2.8.0'
// implementation("androidx.work:work-runtime:2.8.0")
// (Java only)
implementation("androidx.work:work-runtime:$work_version")
// Kotlin + coroutines
implementation("androidx.work:work-runtime-ktx:$work_version")
// optional - RxJava2 support
implementation("androidx.work:work-rxjava2:$work_version")
// optional - GCMNetworkManager support
implementation("androidx.work:work-gcm:$work_version")
// optional - Test helpers
androidTestImplementation("androidx.work:work-testing:$work_version")
// optional - Multiprocess support
implementation "androidx.work:work-multiprocess:$work_version"
}
apply plugin: 'com.google.gms.google-services'
apply plugin: 'io.fabric'
MyFirebaseMessagingService has PendingIntent as follows –
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_IMMUTABLE );
I was trying to upload new version to play store, it ask me to use sdk 31 to upload new version. After setting up sdk 31 then this pending intent crash is introduced. I have tried to add Work-runtime is not resolving the problem. App is crashing at random times with the same error message.
3
Answers
It cost me a lot of time to figure out which library was culprit. It was QuickBlox in my case. I have updated QuickBlox to 4.0.3 and using work-runtime 2.7.1
Now my Build.gradle have following changes -
Crash is gone. Although I will have to rework on QuickBlox functionality as they have changed few things with updated library. Thank you everyone who tried to help.
PendingIntent.FLAG_IMMUTABLE
requires API level 23Since your
minSdkVersion
is 20, you should perform the sdk checkYou should update minSDK to 23 and use following code for PendingIntent :
This worked for me.