Android-java.lang.NoSuchFieldError:android.graphics.Bitmap $ CompressFormat.WEBP [英] Android - java.lang.NoSuchFieldError: android.graphics.Bitmap$CompressFormat.WEBP

查看:95
本文介绍了Android-java.lang.NoSuchFieldError:android.graphics.Bitmap $ CompressFormat.WEBP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用API​​ 1以来已受支持的非常简单的代码。

I'm trying to use a very simple piece of code that has been supported since 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

gives me that weird error: java.lang.NoSuchFieldError: android.graphics.Bitmap$CompressFormat.WEBP and this only happens on my moto razr 2.3

我在互联网上找不到任何相关信息。这是怎么回事? (我清楚地知道,摩托罗拉的股票android没想到要包含它,但是我该如何解决?)有什么提示吗?

i can't find anything on the internet about this. what's going on? (i get that, clearly, motorola's stock android didn't think to include it, but how would i fix this?) any hints?

我要做的就是进行压缩以拍摄屏幕(或视图)的快照,并以 String 的形式以用户友好的方式附加到该屏幕(该设备也未正确执行文件附件)发送给电子邮件意图的主体,并将其传递给可以发送电子邮件的任何人。

all i want to do is to compress take a snapshot of the screen (or view), and attach it IN A USER FRIENDLY WAY in String form (this same device also doesn't do file attachments correctly either) to the body of an email intent, and pass that off to whoever can send emails.

尝试压缩为.jpeg,然后将其转换为base64编码的字符串,然后附加到正文中的电子邮件需要花费很长的时间,而且对用户的响应不是很好。

trying to compress to .jpeg, then converting it to base64 encoded string, and then attaching to email in the body takes forever, and is not very user-responsive. this can't happen.

有什么帮助吗?

推荐答案

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

android.graphics.Bitmap$CompressFormat.WEBP only works for api level 14 or above.

尝试一些WebP库。

Java的WebP库?

Try some WebP libraries.
WebP library for java?

这篇关于Android-java.lang.NoSuchFieldError:android.graphics.Bitmap $ CompressFormat.WEBP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆