Targeting S+ (version 31 and above) "app keeps stopping"

95 Views Asked by At

I probably don't belong on these pages, as I am unlikely to understand most of the responses I get. The Developer who wrote this code has moved on and finding another one takes time. But I have resolved a few issues over the years, so here is my problem. When trying to raise my GooglePlay app's Mandatory Target to S+ (version 31 and above), I upgraded to 3.1 Giraffe on Mac Catalina. The app shows no errors until I get to the Emulators. Then I get these two Errors on logcat panel for emulator Pixel 2 API 32:

E FATAL EXCEPTION: main Process: com.parallelspaces.parkken, PID: 2376 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.parallelspaces.parkken/com.parallelspaces.parkken.MainActivity}: java.lang.IllegalArgumentException: com.parallelspaces.parkken: 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:3685) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3842) 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:2252) 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:7842) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003) Caused by: java.lang.IllegalArgumentException: com.parallelspaces.parkken: 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:375) at android.app.PendingIntent.getActivityAsUser(PendingIntent.java:458) at android.app.PendingIntent.getActivity(PendingIntent.java:444) at android.app.PendingIntent.getActivity(PendingIntent.java:408) at com.parallelspaces.parkken.MainActivity.onCreate(MainActivity.java:152) at android.app.Activity.performCreate(Activity.java:8054) at android.app.Activity.performCreate(Activity.java:8034) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1341) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3666) ... 12 more

AND

E FATAL EXCEPTION: main Process: com.parallelspaces.parkken, PID: 3428 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.parallelspaces.parkken/com.parallelspaces.parkken.MainActivity}: java.lang.IllegalArgumentException: com.parallelspaces.parkken: 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:3685) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3842) 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:2252) 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:7842) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003) Caused by: java.lang.IllegalArgumentException: com.parallelspaces.parkken: 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:375) at android.app.PendingIntent.getActivityAsUser(PendingIntent.java:458) at android.app.PendingIntent.getActivity(PendingIntent.java:444) at android.app.PendingIntent.getActivity(PendingIntent.java:408) at com.parallelspaces.parkken.MainActivity.onCreate(MainActivity.java:152) at android.app.Activity.performCreate(Activity.java:8054) at android.app.Activity.performCreate(Activity.java:8034) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1341) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3666) ... 12 more

I can send more code if that helps.

I tried going back to Artic Fox, but now the app is throwing errors from there too.

I think I am hoping for an upgrade solution or a simple code correction, but welcome any and all advice.

Thanks TomH

0

There are 0 best solutions below