Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/214.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/performance/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android-java.lang.NoSuchFieldError:Android.graphics.Bitmap$CompressFormat.WEBP_Android_Performance_Encoding_Email Attachments_Webp - Fatal编程技术网

Android-java.lang.NoSuchFieldError:Android.graphics.Bitmap$CompressFormat.WEBP

Android-java.lang.NoSuchFieldError:Android.graphics.Bitmap$CompressFormat.WEBP,android,performance,encoding,email-attachments,webp,Android,Performance,Encoding,Email Attachments,Webp,我试图使用一段非常简单的代码,它从API 1开始就受到支持 if (bitmap != null) { ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); bitmap.compress(Bitmap.CompressFormat.WEBP, IMAGE_QUALITY, byteArrayOutputStream); byte[] bytes = byteArrayOutp

我试图使用一段非常简单的代码,它从API 1开始就受到支持

if (bitmap != null) {
    ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
    bitmap.compress(Bitmap.CompressFormat.WEBP, IMAGE_QUALITY, byteArrayOutputStream);
    byte[] bytes = byteArrayOutputStream.toByteArray();
    result = Base64.encodeToString(bytes, Base64.DEFAULT);
}
不知怎的

bitmap.compress(Bitmap.CompressFormat.WEBP, IMAGE_QUALITY, byteArrayOutputStream);
给了我一个奇怪的错误:
java.lang.NoSuchFieldError:android.graphics.Bitmap$CompressFormat.WEBP
,这只发生在我的moto razr 2.3上

我在网上找不到关于这件事的任何信息。发生什么事?(我明白了,很明显,摩托罗拉的股票安卓系统并没有考虑将其包括在内,但我该如何解决这个问题呢?)

我所要做的就是压缩屏幕快照(或视图),并以用户友好的方式将其以
String
形式(同样的设备也不能正确地进行文件附件)附加到电子邮件正文中,然后将其传递给任何可以发送电子邮件的人

尝试压缩为.jpeg,然后将其转换为base64编码字符串,然后在正文中附加到电子邮件会花费很长时间,而且用户响应性不强。这不可能发生


有任何帮助吗?

android.graphics.Bitmap$CompressFormat.WEBP仅适用于api级别14或更高的版本

尝试一些WebP库。

哦。我现在看到了。对不起,我看错了文件。Bitmap.CompressionFormat从api级别1开始就存在。我无意中也将其理解为WEBP的api级别。谢谢