I recently updated my app to target API 31 and have noticed a new crash being reported in the Google Play Console that makes no sense to me.
The crash caused by exception.class.missing._Unknown_: Strongly consider using FLAG_IMMUTABLE... for which there are a number of answers on SO and elsewhere, however from what I have read this crash should be related to use of PendingIntent only.
The crash reports make sense in that I have only seen the crash reported on Android 12 (API 31) as this is where the explicit IMMUTABLE or MUTABLE requirement was introduced, but I have searched the whole of my project and cannot find any use of PendingIntent.
The timing of the crashes appears to tie in with an FCM push notification I sent, which again ties in with the crash coming from PendingIntent, but if I cannot find that in my source then how can I explicitly set FLAG_IMMUTABLE?
My project dependencies are as below:
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.appcompat:appcompat:1.4.0-beta01'
implementation 'com.google.android.material:material:1.4.0'
implementation 'com.google.code.gson:gson:2.8.6'
implementation 'androidx.constraintlayout:constraintlayout:2.1.1'
// billing for in-app purchases
implementation 'com.android.billingclient:billing:3.0.2'
// For in-app review flow
implementation 'com.google.android.play:core:1.10.2'
// Import the Firebase BoM
implementation platform('com.google.firebase:firebase-bom:26.1.1')
implementation 'com.google.firebase:firebase-messaging'
}
This is a known issue with Admob, as mentioned at https://developers.google.com/admob/android/quick-start
androidx.work:work-runtime:2.1.0 pulled from play-services-ads has a bug using PendingIntent without FLAG_IMMUTABLE or FLAG_MUTABLE and will fail in apps targeting S+.
The solution is also mentioned, in the app/build-gradle file:
dependencies {
implementation 'com.google.android.gms:play-services-ads:20.4.0'
// For apps targeting Android 12, add WorkManager dependency.
constraints {
implementation('androidx.work:work-runtime:2.7.0') {
because '''androidx.work:work-runtime:2.1.0 pulled from play-services-ads
has a bug using PendingIntent without FLAG_IMMUTABLE or
FLAG_MUTABLE and will fail in apps targeting S+.'''
}
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With