Question

I'm trying to set a grey effect on an image using setGreyscale.
However, it throws the following exception:

01-29 17:10:51.360: E/RenderScript_jni(27312): No GC methods
01-29 17:10:51.360: D/dalvikvm(27312): Trying to load lib /data/data/com.xxx.android/lib/libRSSupport.so 0x41f636a0
01-29 17:10:51.384: D/dalvikvm(27312): Added shared lib /data/data/com.xxx.android/lib/libRSSupport.so 0x41f636a0
01-29 17:10:51.384: D/dalvikvm(27312): No JNI_OnLoad found in /data/data/com.xxx.android/lib/libRSSupport.so 0x41f636a0, skipping init
01-29 17:10:51.391: D/dalvikvm(27312): Trying to load lib /data/data/com.xxx.android/lib/librsjni.so 0x41f636a0
01-29 17:10:51.391: D/dalvikvm(27312): Added shared lib /data/data/com.xxx.android/lib/librsjni.so 0x41f636a0
01-28 16:48:38.340: E/RenderScript(19242): rsAssert failed: !mElements.size(), in frameworks/rs/rsElement.cpp at 369

Here is the code:

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();
}
Was it helpful?

Solution

It worked after setting sdk.buildtools to version 18.1.0.
Previously, the version was 19.0.0.

Here is my current project.properties:

target=android-19
renderscript.target=18
renderscript.support.mode=true
sdk.buildtools=18.1.0

The assert exception still occurs so it's not related to the actual failure.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top