android – Software rendering doesn't support hardware bitmap in Oreo-ThrowExceptions

Exception or error:
LinearLayout llQRCodeShare;
try {
    llQRCodeShare.setDrawingCacheEnabled(true);
    llQRCodeShare.buildDrawingCache(true);
    Bitmap b = llQRCodeShare.getDrawingCache();
    Bitmap bitmap = Bitmap.createBitmap(b);
    llQRCodeShare.setDrawingCacheEnabled(false);
} catch (IllegalStateException e) {
    LogUtil.e(TAG, e.getMessage());    //Software rendering doesn't support hardware bitmap
}

when execute the code"llQRCodeShare.getDrawingCache()",throws the exception,

Software rendering doesn't support hardware bitmap

on the android8.0.
How to solve it?

How to solve:

disable hardware acceleration either for the whole Activity:

android:hardwareAccelerated="false"

or for that one particular View:

llQRCodeShare.setLayerType(View.LAYER_TYPE_SOFTWARE, null);

###

just make the android:hardwareAccelerated="true" in the AndroidManifest.xml under Application tag

###

In your Manifest add this android:supportsRtl = "true" under the application section.

Leave a Reply

Your email address will not be published. Required fields are marked *