我試圖使用setGreyscale在圖像上設置灰色效果。
當運行它的灰度效果不工作,它引發以下例外Renderscript拋出斷言異常「rsAssert失敗:!mElements.size()」
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):Added共享lib /data/data/com.xxx.android/lib/libRSSupport.so 0x41f636a0
01-29 17:10:51.384:D/dalvikvm(27312):在/data/data/com.xxx中找不到JNI_OnLoad。 android/lib/libRSSupport.so 0x41f636a0,跳過初始化
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(),在369
這裏框架/ RS/rsElement.cpp是我的代碼:
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();
}
這不是實際的崩潰,這是其他事情的副作用。你可以發佈你的完整logcat嗎? –
@TimMurray你說得對,這不是墜機的原因。我已更新帖子並添加了更多logcat消息。我認爲這可能與構建配置有關。 WDYT?謝謝! – Forge
你在運行什麼設備?我仍然沒有看到任何明顯的例外。你在任何地方看到本地堆棧跟蹤或Java堆棧跟蹤嗎? –