FLAG_IMMUTABLE 或 FLAG_MUTABLE 和 FLAG_UPDATE_CURRENT 添加,但仍然错误“Targeting S+(版本 31 及以上)需要 FLAG 之一”

问题描述 投票:0回答:0

我用

implementation "android.arch.work:work-runtime:1.0.0-alpha11"
我没有使用
implementation "androidx.work:work-runtime:2.7.0-alpha05"
因为我的 Activity 中有 PendingIntent

我在我的 PendingIntent.getBroadcast 中添加了 FLAG

PendingIntent permissionIntent = PendingIntent.getBroadcast(this, 0, newIntent(AdjustmentCartActivity.ACTION_USB_PERMISSION)
,PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE);
IntentFilter filter = new IntentFilter(AdjustmentCartActivity.ACTION_USB_PERMISSION);
registerReceiver(this.usbReceiver, filter);

和PendingIntent.getActivity

PendingIntent mPendingIntent = PendingIntent.getActivity(ErrorActivity.this, mPendingIntentId,
mStartActivity,PendingIntent.FLAG_CANCEL_CURRENT |PendingIntent.FLAG_IMMUTABLE |PendingIntent.FLAG_UPDATE_CURRENT);

你能帮我解决这个问题吗,因为这个错误我已经努力了将近一个星期,但仍然没有解决

java android-studio flags android-12
© www.soinside.com 2019 - 2024. All rights reserved.