when compressing image in working in oneplus and oppo android 13 5g Phone thowing error [enter image description here](https://i.stack.imgur.com/LkbS7.png)
code :
@RequiresApi(Build.VERSION_CODES.O)
fun bitmapToBase64(bitmap: Bitmap): String {
val byteArrayOutputStream = ByteArrayOutputStream()
bitmap.compress(Bitmap.CompressFormat.JPEG, 100, byteArrayOutputStream)
val byteArray: ByteArray = byteArrayOutputStream.toByteArray()
return String(Base64.getEncoder().encode(byteArray))
}
it working fine in all devices but it is throwing error only in oneplus devices and oppo,realme
how to fix. most affected device is RMX3741.