1

I am using react native 64.0.3 version to develop the app. Recently I have shifted my sdk 31. I am facing this issue:

"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 Pendingment being mutable, e.g. if it needs to be used with inline replies or bubbles"

My build.gradle(android/app):

dependencies {
    implementation(project(':react-native-svg')) {
        exclude group: "com.android.support", module: "appcompat-v7"
    }
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation 'com.android.support:appcompat-v7:28.0.0'
    //noinspection GradleDynamicVersion
    // implementation('androidx.work:work-runtime:2.7.1')
    implementation "androidx.media:media:1.4.1"
    implementation "com.facebook.react:react-native:+"  // From node_modules
    implementation 'androidx.appcompat:appcompat:1.7.0-alpha01'
    implementation 'androidx.work:work-runtime-ktx:2.7.1'
    implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
    implementation 'com.android.support:multidex:1.0.3'
    implementation project(':react-native-view-pdf')
    implementation project(':rn-fetch-blob')
    implementation project(':react-native-ping')
    implementation project(':react-native-gesture-handler')
    implementation 'com.facebook.fresco:animated-gif:2.6.0'
    debugImplementation("com.facebook.flipper:flipper:0.176.1") {
      exclude group:'com.facebook.fbjni'
    }

    debugImplementation("com.facebook.flipper:flipper-network-plugin:0.176.1") {
        exclude group:'com.facebook.flipper'
        exclude group:'com.squareup.okhttp3', module:'okhttp'
    }

    debugImplementation("com.facebook.flipper:flipper-fresco-plugin:0.176.1") {
        exclude group:'com.facebook.flipper'
    }

    if (enableHermes) {
        def hermesPath = "../../node_modules/hermes-engine/android/";
        debugImplementation files(hermesPath + "hermes-debug.aar")
        releaseImplementation files(hermesPath + "hermes-release.aar")
    } else {
        implementation jscFlavor
    }
}
tomerpacific
  • 4,704
  • 13
  • 34
  • 52
  • Where is the code that uses a pending intent? – tomerpacific Jan 08 '23 at 05:53
  • I did not use Pending Intent Anywhere – kawsar ahmad Jan 08 '23 at 05:57
  • Then one of your dependencies is using it and I would check which version is not compatible with Android 12 currently and upgrade it. – tomerpacific Jan 08 '23 at 05:59
  • But how can I find which dependencies is using it? – kawsar ahmad Jan 08 '23 at 06:00
  • There are two approaches: Either comment out one dependency at a time and see when the compilation succeeds. Or go to each website of each dependency and look at which version supports Android 12. – tomerpacific Jan 08 '23 at 07:48
  • Does this answer your question? [Targeting S+ (version 31 and above) requires that one of FLAG\_IMMUTABLE or FLAG\_MUTABLE be specified](https://stackoverflow.com/questions/70894168/targeting-s-version-31-and-above-requires-that-one-of-flag-immutable-or-flag) – Thanhal P A Jan 08 '23 at 07:54
  • Thank you for your suggestion. This was not the solution it(PendingIntent) was from some unused dependencies, I have removed them now it is working – kawsar ahmad Jan 09 '23 at 03:47
  • If you found a solution, please answer your own question and accept that answer. That will remove this question from the list of unanswered questions. – David Wasser Jan 11 '23 at 15:27

0 Answers0