的renderScript抛出断言异常“rsAssert失败:mElements.size()”

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

我正在尝试设置使用setGreyscale的图像上的灰色效果。 然而,它抛出以下异常:

01-29 17:10:51.360:E / RenderScript_jni(27312):无GC方法 01-29 17:10:51.360:d / dalvikvm(27312):试图加载LIB /data/data/com.xxx.android/lib/libRSSupport.so 0x41f636a0 01-29 17:10:51.384:d / dalvikvm(27312):加入共享库/data/data/com.xxx.android/lib/libRSSupport.so 0x41f636a0 01-29 17:10:51.384:d / dalvikvm(27312):无JNI_OnLoad在/data/data/com.xxx.android/lib/libRSSupport.so 0x41f636a0发现,跳过INIT 01-29 17:10:51.391:d / dalvikvm(27312):试图加载LIB /data/data/com.xxx.android/lib/librsjni.so 0x41f636a0 01-29 17:10:51.391:d / dalvikvm(27312):添加了共享库/data/data/com.xxx.android/lib/librsjni.so 0x41f636a0 01-28 16:48:38.340:E /的renderScript(19242):rsAssert失败:mElements.size(),在框架/ RS / rsElement.cpp 369

下面是代码:

import android.support.v8.renderscript.*;

private synchronized void setGreyScale(Bitmap image){
    Allocation input;
    Allocation output;
    RenderScript rs = RenderScript.create(mContext);
    ScriptIntrinsicColorMatrix scriptColor = ScriptIntrinsicColorMatrix.create(rs, Element.U8_4(rs));
    input = Allocation.createFromBitmap(rs, image, Allocation.MipmapControl.MIPMAP_NONE, Allocation.USAGE_SCRIPT);
    output = Allocation.createTyped(rs, input.getType());
    scriptColor.setGreyscale();
    scriptColor.forEach(input, output);
    output.copyTo(image);                         
    rs.destroy();
}
android image-processing renderscript
1个回答
0
投票

sdk.buildtools设置为版本18.1.0后工作。 此前,该版本是19.0.0

这是我目前的project.properties

目标=机器人-19 renderscript.target = 18 renderscript.support.mode =真 sdk.buildtools = 18.1.0

仍然发生断言异常,所以它不涉及到实际的故障。

© www.soinside.com 2019 - 2024. All rights reserved.