对于输入和输出(2位图),使用构建工具25.0.3和renderscriptTargetApi 21,Allocation.createFromBitmap
,基本上一切都与示例中的完全相同:
Allocation inAllocation = Allocation.createFromBitmap(renderScript, bitmap);
...
ScriptIntrinsicBlur blurScript = ScriptIntrinsicBlur.create(renderScript, Element.U8_4(renderScript));
blurScript.setRadius(blurRadius);
blurScript.setInput(inAllocation);
blurScript.forEach(outAllocation);
outAllocation.copyTo(outputBitmap);
最近几天,我开始在三星Galaxy S6设备上遇到以下崩溃:
05-10 12:11:48.751 ? A/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
05-10 12:11:48.751 ? A/DEBUG: Build fingerprint: 'samsung/zenltexx/zenlte:6.0.1/MMB29K/G928FXXS2BPG2:user/release-keys'
05-10 12:11:48.751 ? A/DEBUG: Revision: '9'
05-10 12:11:48.751 ? A/DEBUG: ABI: 'arm64'
05-10 12:11:48.751 ? A/DEBUG: pid: 14905, tid: 14985, name: RenderThread >>> my.app <<<
05-10 12:11:48.751 ? A/DEBUG: signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x28
05-10 12:11:48.791 ? A/DEBUG: x0 0000007f5a13ef50 x1 0000007f8403e588 x2 9592f52992562749 x3 9592f52992562749
05-10 12:11:48.791 ? A/DEBUG: x4 ffffffffffffffff x5 8080808000000000 x6 0000000080808080 x7 fefefeff636d746e
05-10 12:11:48.791 ? A/DEBUG: x8 0000000000000000 x9 fefefefefefefeff x10 7f7f7f7f7f7f7f7f x11 0101010101010101
05-10 12:11:48.791 ? A/DEBUG: x12 0000000000000020 x13 0000000000000000 x14 0000000000000001 x15 0000000000000006
05-10 12:11:48.791 ? A/DEBUG: x16 0000007fa3a84b08 x17 0000007fa3018b3c x18 0000007fa57a7720 x19 0000007f561975d8
05-10 12:11:48.791 ? A/DEBUG: x20 0000007f8403e588 x21 0000007f7e3ef000 x22 0000007f56b8d408 x23 0000000000000002
05-10 12:11:48.791 ? A/DEBUG: x24 0000007f8403e648 x25 0000007f8403e588 x26 0000007f54ef2000 x27 0000000000000002
05-10 12:11:48.791 ? A/DEBUG: x28 0000007f561975d8 x29 0000007f8403e4e0 x30 0000007fa3a0e14c
05-10 12:11:48.791 ? A/DEBUG: sp 0000007f8403e4a0 pc 0000007fa3018b5c pstate 0000000060000000
05-10 12:11:48.791 ? A/DEBUG: backtrace:
05-10 12:11:48.791 ? A/DEBUG: #00 pc 000000000001bb5c /system/lib64/libRScpp.so (_ZN7android3RSC19ScriptIntrinsicBlur8setInputENS0_2spINS0_10AllocationEEE+32)
05-10 12:11:48.791 ? A/DEBUG: #01 pc 000000000004a148 /system/lib64/libhwui.so
05-10 12:11:48.791 ? A/DEBUG: #02 pc 000000000004a8b4 /system/lib64/libhwui.so
05-10 12:11:48.791 ? A/DEBUG: #03 pc 0000000000083ac4 /system/lib64/libhwui.so
05-10 12:11:48.791 ? A/DEBUG: #04 pc 000000000005f1c0 /system/lib64/libhwui.so
05-10 12:11:48.791 ? A/DEBUG: #05 pc 000000000005ff74 /system/lib64/libhwui.so
05-10 12:11:48.791 ? A/DEBUG: #06 pc 000000000003d0a4 /system/lib64/libhwui.so
05-10 12:11:48.791 ? A/DEBUG: #07 pc 0000000000039780 /system/lib64/libhwui.so
05-10 12:11:48.791 ? A/DEBUG: #08 pc 000000000003a198 /system/lib64/libhwui.so
05-10 12:11:48.791 ? A/DEBUG: #09 pc 0000000000058420 /system/lib64/libhwui.so
05-10 12:11:48.791 ? A/DEBUG: #10 pc 00000000000283bc /system/lib64/libhwui.so
05-10 12:11:48.791 ? A/DEBUG: #11 pc 000000000002aa68 /system/lib64/libhwui.so
05-10 12:11:48.791 ? A/DEBUG: #12 pc 000000000002ef50 /system/lib64/libhwui.so (_ZN7android10uirenderer12renderthread12RenderThread10threadLoopEv+124)
05-10 12:11:48.791 ? A/DEBUG: #13 pc 000000000001699c /system/lib64/libutils.so (_ZN7android6Thread11_threadLoopEPv+208)
05-10 12:11:48.791 ? A/DEBUG: #14 pc 0000000000095160 /system/lib64/libandroid_runtime.so (_ZN7android14AndroidRuntime15javaThreadShellEPv+96)
05-10 12:11:48.791 ? A/DEBUG: #15 pc 00000000000161ec /system/lib64/libutils.so
05-10 12:11:48.791 ? A/DEBUG: #16 pc 0000000000065f20 /system/lib64/libc.so (_ZL15__pthread_startPv+52)
05-10 12:11:48.791 ? A/DEBUG: #17 pc 000000000001edec /system/lib64/libc.so (__start_thread+16)
到目前为止,这种崩溃似乎不会发生在任何其他地方。有没有人遇到同样的问题并知道它的原因或解决方法?