0

I am facing Pending intent problem please help me to solve I have tried all scenarios but its not worked well

E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.jikkisservices.user, PID: 31490
    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.jikkisservices.user/com.jikkisservices.user.UberXHomeActivity}: java.lang.IllegalArgumentException: com.jikkisservices.user: 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.performLaunchActivity(ActivityThread.java:4111)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4277)
        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:103)
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2443)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loopOnce(Looper.java:226)
        at android.os.Looper.loop(Looper.java:313)
        at android.app.ActivityThread.main(ActivityThread.java:8751)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1135)
     Caused by: java.lang.IllegalArgumentException: com.jikkisservices.user: 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:382)
        at android.app.PendingIntent.getBroadcastAsUser(PendingIntent.java:673)
        at android.app.PendingIntent.getBroadcast(PendingIntent.java:660)
        at com.general.files.NotificationScheduler.cancelReminder(SourceFile:62)
        at com.general.files.NotificationScheduler.setReminder(SourceFile:33)
        at com.general.files.ConfigPubNub.getUpdatedPassengerStatus(ConfigPubNub.java:380)
        at com.general.files.ConfigPubNub.onTaskRun(ConfigPubNub.java:468)
        at com.general.files.UpdateFrequentTask.run(SourceFile:30)
        at com.general.files.UpdateFrequentTask.startRepeatingTask(SourceFile:43)
        at com.general.files.ConfigPubNub.buildPubSub(ConfigPubNub.java:128)
        at com.general.files.MyApp.configPuSubInstance(MyApp.java:572)
        at com.general.files.MyApp.access$100(MyApp.java:65)
        at com.general.files.MyApp$1.onActivityCreated(MyApp.java:371)
        at android.app.Application.dispatchActivityCreated(Application.java:372)
        at android.app.Activity.dispatchActivityCreated(Activity.java:1374)
        at android.app.Activity.onCreate(Activity.java:1651)
        at androidx.core.app.ComponentActivity.onCreate(ComponentActivity.java:85)
        at androidx.activity.ComponentActivity.onCreate(ComponentActivity.java:149)
        at androidx.fragment.app.FragmentActivity.onCreate(FragmentActivity.java:313)
        at androidx.appcompat.app.AppCompatActivity.onCreate(AppCompatActivity.java:115)
        at com.jikkisservices.user.BaseActivity.onCreate(BaseActivity.java:18)
        at com.jikkisservices.user.UberXHomeActivity.onCreate(UberXHomeActivity.java:54)
        at android.app.Activity.performCreate(Activity.java:8290)
        at android.app.Activity.performCreate(Activity.java:8270)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1329)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:4085)
            ... 12 more

This code works well in Android 11 but this error showing in version 12 only.

Joachim Sauer
  • 302,674
  • 57
  • 556
  • 614

1 Answers1

0

If you used PendingIntent in your project, you should change that lines as instructed. But probably that's not the case.

The thing is libraries you used can use PendingIntent too. You should update all your libraries to latest versions. That worked for me.

A.Cem
  • 3
  • 1