在某些设备上调用NotificationCompat.Builder.setLargeIcon(bitmap)时发生本机崩溃

时间:2019-02-13 05:42:41

标签: android android-notifications android-bitmap

以下是我的崩溃报告(SIGABRT本机错误):

1 #00 pc 0001a3d4 /system/lib/libc.so (abort+63) [armeabi-v8]
2 #01 pc 00006581 /system/lib/liblog.so (__android_log_assert+160) [armeabi-v8]
3 #02 pc 000aed61 /system/lib/libandroid_runtime.so [armeabi-v8]
4 #03 pc 000aed61 /system/lib/libandroid_runtime.so [armeabi-v8]
5 #04 pc 000aed61 /system/lib/libandroid_runtime.so [armeabi-v8]
6 #05 pc 000aed61 /system/lib/libandroid_runtime.so [armeabi-v8]
7 #06 pc 000aed61 /system/lib/libandroid_runtime.so [armeabi-v8]
8 #07 pc 000aed61 /system/lib/libandroid_runtime.so [armeabi-v8]
9 #08 pc 000aed61 /system/lib/libandroid_runtime.so [armeabi-v8]
10 #09 pc 000aed61 /system/lib/libandroid_runtime.so [armeabi-v8]
11 #10 pc 000aed61 /system/lib/libandroid_runtime.so [armeabi-v8]
12 #11 pc 000aed61 /system/lib/libandroid_runtime.so [armeabi-v8]
13 #12 pc 000aed61 /system/lib/libandroid_runtime.so [armeabi-v8]
14 #13 pc 000aed61 /system/lib/libandroid_runtime.so [armeabi-v8]
15 #14 pc 000aed61 /system/lib/libandroid_runtime.so [armeabi-v8]
16 #15 pc 000aed61 /system/lib/libandroid_runtime.so [armeabi-v8]
17 #16 pc 000aed61 /system/lib/libandroid_runtime.so [armeabi-v8]
18 #17 pc 000aed61 /system/lib/libandroid_runtime.so [armeabi-v8]
19 #18 pc 000aed61 /system/lib/libandroid_runtime.so [armeabi-v8]
20 #19 pc 000aed61 /system/lib/libandroid_runtime.so [armeabi-v8]
21 #20 pc 000aed61 /system/lib/libandroid_runtime.so [armeabi-v8]
22 #21 pc 000aed61 /system/lib/libandroid_runtime.so [armeabi-v8]
23 #22 pc 000aed61 /system/lib/libandroid_runtime.so [armeabi-v8]
24 #23 pc 000aed61 /system/lib/libandroid_runtime.so [armeabi-v8]
25 #24 pc 000aed61 /system/lib/libandroid_runtime.so [armeabi-v8]
26 #25 pc 000aed61 /system/lib/libandroid_runtime.so [armeabi-v8]
27 #26 pc 000aed61 /system/lib/libandroid_runtime.so [armeabi-v8]
28 #27 pc 000aed61 /system/lib/libandroid_runtime.so [armeabi-v8]
29 #28 pc 000aed61 /system/lib/libandroid_runtime.so [armeabi-v8]
30 #29 pc 000aed61 /system/lib/libandroid_runtime.so [armeabi-v8]
31 #30 pc 000aed61 /system/lib/libandroid_runtime.so [armeabi-v8]
32 #31 pc 000aed61 /system/lib/libandroid_runtime.so [armeabi-v8]
33 #32 pc 000aed61 /system/lib/libandroid_runtime.so [armeabi-v8]
34 #33 pc 000aed61 /system/lib/libandroid_runtime.so [armeabi-v8]
35 #34 pc 000aed61 /system/lib/libandroid_runtime.so [armeabi-v8]
36 #35 pc 000aed61 /system/lib/libandroid_runtime.so [armeabi-v8]
37 #36 pc 000aed61 /system/lib/libandroid_runtime.so [armeabi-v8]
38 #37 pc 000aed61 /system/lib/libandroid_runtime.so [armeabi-v8]
39 #38 pc 000aed61 /system/lib/libandroid_runtime.so [armeabi-v8]
40 #39 pc 000aed61 /system/lib/libandroid_runtime.so [armeabi-v8]
41 #40 pc 000aed61 /system/lib/libandroid_runtime.so [armeabi-v8]
42 #41 pc 000aed61 /system/lib/libandroid_runtime.so [armeabi-v8]
43 #42 pc 000aed61 /system/lib/libandroid_runtime.so [armeabi-v8]
44 #43 pc 000aed61 /system/lib/libandroid_runtime.so [armeabi-v8]
45 #44 pc 000aed61 /system/lib/libandroid_runtime.so [armeabi-v8]
46 #45 pc 000aed61 /system/lib/libandroid_runtime.so [armeabi-v8]
47 #46 pc 000aed61 /system/lib/libandroid_runtime.so [armeabi-v8]
48 #47 pc 000aed61 /system/lib/libandroid_runtime.so [armeabi-v8]
49 #48 pc 000aed61 /system/lib/libandroid_runtime.so [armeabi-v8]
50 #49 pc 000aed61 /system/lib/libandroid_runtime.so [armeabi-v8]
51 #50 pc 000aed61 /system/lib/libandroid_runtime.so [armeabi-v8]
52 #51 pc 000aed61 /system/lib/libandroid_runtime.so [armeabi-v8]
53 #52 pc 000aed61 /system/lib/libandroid_runtime.so [armeabi-v8]
54 #53 pc 000aed61 /system/lib/libandroid_runtime.so [armeabi-v8]
55 #54 pc 000aed61 /system/lib/libandroid_runtime.so [armeabi-v8]
56 #55 pc 000aed61 /system/lib/libandroid_runtime.so [armeabi-v8]
57 #56 pc 000aed61 /system/lib/libandroid_runtime.so [armeabi-v8]
58 #57 pc 000aed61 /system/lib/libandroid_runtime.so [armeabi-v8]
59 #58 pc 000aed61 /system/lib/libandroid_runtime.so [armeabi-v8]
60 #59 pc 000aed61 /system/lib/libandroid_runtime.so [armeabi-v8]
61 #60 pc 000aed61 /system/lib/libandroid_runtime.so [armeabi-v8]
62 #61 pc 000aed61 /system/lib/libandroid_runtime.so [armeabi-v8]
63 #62 pc 000aed61 /system/lib/libandroid_runtime.so [armeabi-v8]
64 #63 pc 000aed61 /system/lib/libandroid_runtime.so [armeabi-v8]
65 #64 pc 000aed61 /system/lib/libandroid_runtime.so [armeabi-v8]
66 #65 pc 000aed61 /system/lib/libandroid_runtime.so [armeabi-v8]
67 #66 pc 000aed61 /system/lib/libandroid_runtime.so [armeabi-v8]
68 #67 pc 000aed61 /system/lib/libandroid_runtime.so [armeabi-v8]
69 #68 pc 000aed61 /system/lib/libandroid_runtime.so [armeabi-v8]
70 #69 pc 000aed61 /system/lib/libandroid_runtime.so [armeabi-v8]
71 #70 pc 000aed61 /system/lib/libandroid_runtime.so [armeabi-v8]
72 #71 pc 000aed61 /system/lib/libandroid_runtime.so [armeabi-v8]
73 #72 pc 000aed61 /system/lib/libandroid_runtime.so [armeabi-v8]
74 #73 pc 000aed61 /system/lib/libandroid_runtime.so [armeabi-v8]
75 #74 pc 000aed61 /system/lib/libandroid_runtime.so [armeabi-v8]
76 #75 pc 000aed61 /system/lib/libandroid_runtime.so [armeabi-v8]
77 #76 pc 000aed61 /system/lib/libandroid_runtime.so [armeabi-v8]
78 #77 pc 000aed61 /system/lib/libandroid_runtime.so [armeabi-v8]
79 #78 pc 000aed61 /system/lib/libandroid_runtime.so [armeabi-v8]
80 #79 pc 000aed61 /system/lib/libandroid_runtime.so [armeabi-v8]
81 #80 pc 000aed61 /system/lib/libandroid_runtime.so [armeabi-v8]
82 #81 pc 000aed61 /system/lib/libandroid_runtime.so [armeabi-v8]
83 #82 pc 000aed61 /system/lib/libandroid_runtime.so [armeabi-vjava:
84 android.graphics.Bitmap.nativeCopyColorSpace(Native Method)
85 android.graphics.Bitmap.createBitmap(Bitmap.java:872)
86 android.graphics.Bitmap.createScaledBitmap(Bitmap.java:733)
87 android.graphics.drawable.Icon.scaleDownIfNecessary(Icon.java:822)
88 android.graphics.drawable.Icon.scaleDownIfNecessary(Icon.java:841)
89 android.app.Notification.reduceImageSizes(Notification.java:5237)
90 android.app.Notification$Builder.build(Notification.java:5007)
91 android.support.v4.app.NotificationCompatBuilder.buildInternal(NotificationCompatBuilder.java:250)
92 android.support.v4.app.NotificationCompatBuilder.build(NotificationCompatBuilder.java:189)
93 android.support.v4.app.NotificationCompat$Builder.build(NotificationCompat.java:1484)

在调用setLargeIcon()的{​​{1}}方法时,某些操作系统版本为Android 8.1和Android 9.0的设备将发生错误。

我发现NotificationCompat.Builder是在Android 8.1中首次添加的新方法,而Icon.scaleDownIfNecessary()是在Android 8.0中首次添加的新方法。 / p>

如何解决/避免它?

0 个答案:

没有答案