Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent.
Closed this issue · 1 comments
Hi,
I got this error In Android Version 12
Everything works fine in Android 11
Could you please suggest me a solution to solve the problem mentioned below.
Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent.
ERROR Your app just crashed. See the error below. java.lang.RuntimeException: Unable to start activity ComponentInfo{com.xxx.xxx/com.jackbayliss.nfcreader.NfcCardReaderActivity}: java.lang.IllegalArgumentException: com.xxx.xxx: 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. android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3780) android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3942) android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:109) android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135) android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95) android.app.ActivityThread$H.handleMessage(ActivityThread.java:2345) android.os.Handler.dispatchMessage(Handler.java:106) android.os.Looper.loopOnce(Looper.java:233) android.os.Looper.loop(Looper.java:344) android.app.ActivityThread.main(ActivityThread.java:8212) java.lang.reflect.Method.invoke(Native Method) com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:584) com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1034) Caused by java.lang.IllegalArgumentException: com.xxx.xxx: 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. android.app.PendingIntent.checkFlags(PendingIntent.java:378) android.app.PendingIntent.getActivityAsUser(PendingIntent.java:461) android.app.PendingIntent.getActivity(PendingIntent.java:447) android.app.PendingIntent.getActivity(PendingIntent.java:411) com.pro100svitlo.creditCardNfcReader.utils.CardNfcUtils.<init>(CardNfcUtils.java:29) com.jackbayliss.nfcreader.NfcCardReaderActivity.onCreate(NfcCardReaderActivity.java:36) android.app.Activity.performCreate(Activity.java:8129) android.app.Activity.performCreate(Activity.java:8109) android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1344) android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3749) android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3942) android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:109) android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135) android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95) android.app.ActivityThread$H.handleMessage(ActivityThread.java:2345) android.os.Handler.dispatchMessage(Handler.java:106) android.os.Looper.loopOnce(Looper.java:233) android.os.Looper.loop(Looper.java:344) android.app.ActivityThread.main(ActivityThread.java:8212) java.lang.reflect.Method.invoke(Native Method) com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:584) com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1034)
I have exactly the same problem