be at one's books 的结实?
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了be at one's books 的结实?相关的知识,希望对你有一定的参考价值。
是不是用功学习
词霸上没有,所以这里一下
根据上下文,可以引申为"用功学习"或"心不在焉地看书".
http://72.14.203.104/search?q=cache:CcDcmLvwMWQJ:homepage.mac.com/thorntonstreiff/Todd_Poetry.html++%22am+at+my+books%22&hl=en&gl=us&ct=clnk&cd=1
http://www.thing.net/~xaf/mccoy/smapp/button.html
Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified
最近在写代码时碰到如下错误:
java.lang.IllegalArgumentException: com.example.imdemo: 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.
出错的代码主要是在创建通知栏消息时抛出的,主要代码如下:
private void createNotification()
Intent intent = new Intent(this, OtherActivity.class);
// 这一行报错
PendingIntent pendingIntent = PendingIntent.getActivity(this, 123, intent, PendingIntent.FLAG_ONE_SHOT);
NotificationCompat.Builder builder = new NotificationCompat.Builder(this, NOTIFICATION_CHANNEL_ID)
.setSmallIcon(R.mipmap.ic_launcher)
.setContentTitle("测试")
.setContentText("收到一条通知消息")
.setContentIntent(pendingIntent)
.setPriority(NotificationCompat.PRIORITY_HIGH)
.setAutoCancel(true);
Notification build = builder.build();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O)
NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.createNotificationChannel(
new NotificationChannel(NOTIFICATION_CHANNEL_ID, "测试测试", NotificationManager.IMPORTANCE_HIGH)
);
NotificationManagerCompat.from(this).notify(notificationId++, build);
查了一番资料后,发现如下几个修复的方法:
-
将项目的targetSdkVersion由31改为30
-
如果不想改targetSdkVersion,那就在在创建PendingIntent的时候判断当前系统版本,根据不同系统版本创建带有不同flag的PendingIntent,具体代码实现如下:
PendingIntent pendingIntent; if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.S) pendingIntent = PendingIntent.getActivity(this, 123, intent, PendingIntent.FLAG_IMMUTABLE); else pendingIntent = PendingIntent.getActivity(this, 123, intent, PendingIntent.FLAG_ONE_SHOT);
-
直接在项目中依赖下面的库
dependencies // For Java implementation 'androidx.work:work-runtime:2.7.1' // For Kotlin implementation 'androidx.work:work-runtime-ktx:2.7.1'
这里最推荐的是使用上面的方法2。
以上是关于be at one's books 的结实?的主要内容,如果未能解决你的问题,请参考以下文章
No cache could be resolved for……. At least one cache should be provided per cache operation
python执行ffmpeg 报错:at least one output file must be specified
Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specifie
it's+a+red+and+yellow+butterfly改疑问句
Raspberry Pi 3B won't turn on after being powered on All In One
pycharm the project at uses a non standard layout and cannot be attached to