0

The app is crashing on this method but not showing any crash log. This is only happening on few devices e.g (HTC one m9), its working perfectly on HTC Desire Pro 10 and Galaxy s6 edge. App is crashing on script.forEach(output); this line.

  private static Bitmap blur(Bitmap src) {
    RenderScript rs = RenderScript.create(BaseApplication.getAppContext());
    final Allocation input = Allocation.createFromBitmap(rs, src); //use this constructor for best performance, because it uses USAGE_SHARED mode which reuses memory
    final Allocation output = Allocation.createTyped(rs, input.getType());
    final ScriptIntrinsicBlur script = ScriptIntrinsicBlur.create(rs, Element.U8_4(rs));
    script.setRadius(5f);
    script.setInput(input);
    script.forEach(output);
    output.copyTo(src);
    return src;
    }
Hamza Khan
  • 1,433
  • 13
  • 19
  • no logcat is appearing. similar case with this https://stackoverflow.com/questions/18709301/android-renderscript-allocation-usage-shared-crash?rq=1 – Hamza Khan Nov 01 '17 at 14:19
  • 11-01 19:26:33.587 20689-21107/com.ingic.aaloo A/libc: Fatal signal 7 (SIGBUS), code 2, fault addr 0xbeb0d000 in tid 21107 (com.ingic.aaloo) 11-01 19:26:33.587 20689-21114/com.ingic.aaloo A/libc: Fatal signal 7 (SIGBUS), code 2, fault addr 0xbeb0d000 in tid 21114 (com.ingic.aaloo) 11-01 19:26:33.588 20689-21111/com.ingic.aaloo A/libc: Fatal signal 7 (SIGBUS), code 2, fault addr 0xbeb0d000 in tid 21111 (com.ingic.aaloo) – Hamza Khan Nov 01 '17 at 14:27

1 Answers1

0

I resolved this problem, this issue was happening because my bitmap configuration was not Bitmap.Config.ARGB_8888, we should convert it to ARGB_8888 before applying the blur.

    Bitmap U8_4Bitmap;
    if (yourBitmap.getConfig() == Bitmap.Config.ARGB_8888) {
        U8_4Bitmap = yourBitmap;
    } else {
        U8_4Bitmap = yourBitmap.copy(Bitmap.Config.ARGB_8888, true);
    }
Hamza Khan
  • 1,433
  • 13
  • 19