小米 11 MIUI 14.0.8 不管是 apk 安装还是 google play 安装都报错了。
E FATAL EXCEPTION: main
Process: com.guicheng.easyalarm2, PID: 17748
java.lang.RuntimeException: Unable to start service com.guicheng.easyalarm2.AlarmService@7e0e6ed with Intent { cmp=com.guicheng.easyalarm2/.AlarmService (has extras) }: java.lang.IllegalArgumentException: com.guicheng.easyalarm2: 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.handleServiceArgs(ActivityThread.java:4863)
at android.app.ActivityThread.-$$Nest$mhandleServiceArgs(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2254)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:210)
at android.os.Looper.loop(Looper.java:299)
at android.app.ActivityThread.main(ActivityThread.java:8237)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$
MethodAndArgsCaller.run(RuntimeInit.java:559)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:954)
Caused by: java.lang.IllegalArgumentException: com.guicheng.easyalarm2: 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:404)
at android.app.PendingIntent.getActivityAsUser(PendingIntent.java:487)
at android.app.PendingIntent.getActivity(PendingIntent.java:473)
at android.app.PendingIntent.getActivity(PendingIntent.java:437)
at com.guicheng.easyalarm2.AlarmService.onStartCommand(:4)
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:4845)
... 9 more
2023-04-21 11:06:25.981 2280-2687 ActivityTaskManager system_server W Force finishing activity com.guicheng.easyalarm2/.MainActivity