Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android - Signal 11, RS CPP error: Blur radius out of 0-25 pixel bound

Tags:

android

When upgrading my application to run on 4.4.2 devices I received the error

RS CPP error: Blur radius out of 0-25 pixel bound

accompanied by a Signal 11 (native code) error:

Fatal signal 11 (SIGSEGV) at 0x00000028 (code=1)

The root of this issue took me a long time to locate with no results on Google or stack overflow and a search of my code for any use of 'blur' not revealing anything.

like image 657
Nick Cardoso Avatar asked Apr 13 '14 21:04

Nick Cardoso


3 Answers

Eventually I did manage to track the problem, which was in my styles.xml - in one place I used

<item name="android:shadowRadius">30</item>

on a style extending android:TextAppearance.Holo.Widget.TextView. The fix for this issue was just to use a value within the range stated in the error, e.g.

<item name="android:shadowRadius">25</item>

I hope this helps somebody else with a similar problem from having to spend a long time locating their issue!

like image 155
Nick Cardoso Avatar answered Nov 18 '22 22:11

Nick Cardoso


This also happens if you specify the shadowRadius in dp and the converted pixel radius is higher than 25.

So for example if you specify your radius to be 8dp and run the app on a xxxhdpi device (density multiplier 4), the effective radius in pixels is 32.

like image 32
P.Melch Avatar answered Nov 18 '22 20:11

P.Melch


If you need to go higher than a 25 pixel blur radius, then you can turn off hardware rendering.

android:layerType="software"

or

myView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);

See the Hardware acceleration documentation.

In my experience, turning off the "acceleration" didn't seem to negatively affect the performance for my particular app. However, there was a slightly noticeable difference in the quality of the blur.

With hardware rendering:

enter image description here

With software rendering:

enter image description here

(The two images above were taken from a Xiaomi 2 phone running Android 5. Newer hardware and software might give different results.)

This quality hit is undesirable but I found it to be acceptable for most cases. And there really wasn't another option since in addition to the above crash I was getting a lot of other very strange bugs when using hardware acceleration.

like image 32
Suragch Avatar answered Nov 18 '22 21:11

Suragch