Notification 在android O 引起的bug
现象:notification在lollipop上能显示,在Android Oreo and above 不能显示
原因:notitcation在通过new NotificationCompat.Builder().build()这一步中的Builder()方法时,在8及以上版本是必须指定一个channels,在发送通知前,最好在Activity活动oncreate()初始化channel对象
解决:
指定channels渠道,对smallIcon 和 largeIcon 有一定的要求,
各种手机标准不定。
小图制作方法:
- In Android Studio, go to File > New > Image Asset.
- From the Icon Type drop-down list, select Notification Icons.
- Click the icon next to the Clip Art item to select a Material Design icon for your notification. For this app, use the Android icon.
- Rename the resource ic_android and click Next and Finish. This creates drawable files with different resolutions for different API levels.
FileProvider在android O 引起的bug
现象:android8.1以上进行程序间文件共享使用FileProvider时出现的构造 SD 卡异常错误
使用这段代码去共享手机照片时:
1 | mImageUri = FileProvider.getUriForFile(this, "com.example.cameraalbumtest.fileprovider", outputImage); |
Error:
1 | java.lang.IllegalArgumentException: Failed to find configured root |
解决:
在file_paths.xml文件中添加root-path 标签
1 |
|
- 本文作者: 风追着云
- 本文链接: https:/github.com/tuyrt7/tuyrt7.github.io/2019/09/10/遇到的Android-O-新特性问题/
- 版权声明: 本博客所有文章除特别声明外,均采用 MIT 许可协议。转载请注明出处!

SongTaste