Android O: Dragshadowbuilder Throws Illegalstateexception: Software Rendering Doesn't Support Hardware Bitmaps
Solution 1:
This Glide issue on the Glide web site explains what's going on: https://github.com/bumptech/glide/issues/2309
The solution is to disable hardware acceleration in Glide: http://bumptech.github.io/glide/javadocs/431/com/bumptech/glide/request/RequestOptions.html#disallowHardwareConfig--
Disables the use of Bitmap.Config.HARDWARE in Downsampler to avoid errors caused by [...] drawing to Canvass backed by Bitmaps
The code below shows how to disable hardware acceleration for the specific image.
GlideApp.with(context)
.applyDefaultRequestOptions(new RequestOptions().disallowHardwareConfig())
.load(imageUrl)
.into(imageView);
Solution 2:
Workaround for ANDROID O causes an error"IllegalStateException: Software rendering doesn't support hardware bitmaps".
Recode your public class GlideConfiguration extends AppGlideModule as below:
RequestOptionsoptions=newRequestOptions();
booleanisAndroidO= (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O);
DecodeFormatformat= isAndroidO ? DecodeFormat.PREFER_ARGB_8888 : DecodeFormat.PREFER_RGB_565;
options.format(format);
if (isAndroidO) options.disallowHardwareConfig();
builder.setDiskCache(newInternalCacheDiskCacheFactory(context, diskCacheSizeBytes));
builder.setDefaultRequestOptions(options);
Solution 3:
Disclaimer:- I didn't use glide in this activity still I was getting "IllegalStateException: Software rendering doesn't support hardware bitmaps"
I solved this error by creating a new activity and copy the code block while also checking does my app run after adding code.
finally, my app is running without any error and I didn't get why this error was thrown.
Post a Comment for "Android O: Dragshadowbuilder Throws Illegalstateexception: Software Rendering Doesn't Support Hardware Bitmaps"