NoSuchMethodError在Android应用程序中使用commonc编解码器 [英] NoSuchMethodError using commonc codec in Android application

查看:234
本文介绍了NoSuchMethodError在Android应用程序中使用commonc编解码器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在eclipse中为apache.org(commons-codec-1.4.jar)添加了commons编解码器,用于Android应用程序,遵循此处。代码中没有错误。但是当我运行应用程序并调用使用编解码器的功能时,应用程序停止并需要关闭。

I added the commons codec from apache.org (commons-codec-1.4.jar) in eclipse for my Android application following the instruction here. There is no error in the code. But when I run the application and call the function that use the codec the application stop and need a fore close.

在logCat中说:

Android运行时:java.lang.NoSuchMethodError:org.apache.commons。 code.binary.Base64.encodeBase64String

Android Runtime: java.lang.NoSuchMethodError: org.apache.commons.codec.binary.Base64.encodeBase64String

代码行是:
String tmpStr = Base64.encodeBase64String(msg); // msg是一个字节[]

the codeline is: String tmpStr = Base64.encodeBase64String(msg); //msg is a byte[]

应用程序是一个最小的SDK版本= 7(Android 2.1),所以我不能使用 Android Base64

The application is for a min SDK version = 7 (Android 2.1), so I can't use Android Base64

任何想法如何我可以解决问题吗?

Any idea how can I solve the problem?

推荐答案

我无法使公共编码解码器在2.1模拟器上运行。我最后放弃了自己的,复制代码:

I couldn't get the commons codec to run on a 2.1 emulator either. I gave up in the end and made my own, copying the code from:

Base64编码器/解码器

只有一百多行。

这篇关于NoSuchMethodError在Android应用程序中使用commonc编解码器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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