flutter java.lang.IllegalArgumentException:FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent

27 Views Asked by At

I'm using flutter to make an android app. but it has a problem when i upload it. layconsole is catching problems, and I can't solve this. I can't even know where the problem is happening.

Exception java.lang.RuntimeException: Unable to resume activity : 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.ActivityThread.performResumeActivity (ActivityThread.java:4803)
  at android.app.ActivityThread.handleResumeActivity (ActivityThread.java:4836)
  at android.app.servertransaction.ResumeActivityItem.execute (ResumeActivityItem.java:54)
  at android.app.servertransaction.ActivityTransactionItem.execute (ActivityTransactionItem.java:45)
  at android.app.servertransaction.TransactionExecutor.executeLifecycleState (TransactionExecutor.java:176)
  at android.app.servertransaction.TransactionExecutor.execute (TransactionExecutor.java:97)
  at android.app.ActivityThread$H.handleMessage (ActivityThread.java:2308)
  at android.os.Handler.dispatchMessage (Handler.java:106)
  at android.os.Looper.loopOnce (Looper.java:201)
  at android.os.Looper.loop (Looper.java:288)
  at android.app.ActivityThread.main (ActivityThread.java:7898)
  at java.lang.reflect.Method.invoke
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:548)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:936)

In build.gradle, I added this line but isn't solving the problem.

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
    implementation 'androidx.work:work-runtime-ktx:2.7.0'
}

Edit : This is my pubspec.yaml

version: 1.0.0+2

environment:
  sdk: '>=3.2.3 <4.0.0'

dependencies:
  flutter:
    sdk: flutter
  dio:
  lottie:
  mobile_scanner: ^3.5.6
  image_picker: ^1.0.7
  google_ml_kit: ^0.16.3
  any_link_preview:
    path: ./any_link_preview-modified/
  nfc_manager:
    git:
      url: https://github.com/okadan/flutter-nfc-manager
      branch: master
  flutter_native_splash: ^2.3.9
  url_launcher: ^6.2.4
  
dev_dependencies:
  flutter_test:
    sdk: flutter
  flutter_lints: ^2.0.0
0

There are 0 best solutions below