的NoSuchMethodError使用commonc codeC在Android应用程序 [英] NoSuchMethodError using commonc codec in Android application

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

问题描述

我添加了公共$ C $从apache.org在Eclipse CC(commons- codeC-1.4.jar)为我的Andr​​oid应用程序下面的指令<一href="http://stackoverflow.com/questions/2316445/how-to-use-and-package-a-jar-file-with-my-android-app">here.有一个在code没有错误。但是,当我运行的应用程序,并调用使用codeC的应用程序停机,需要一个前关闭该功能。

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 codec.binary.Base64.en codeBase64String

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

在$ C $克莱因是:     字符串tmpStr = Base64.en codeBase64String(MSG); // msg是一个byte []

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

该应用程序是一个最小的SDK版本= 7(Android 2.1的),所以我不能使用安卓的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?

推荐答案

我经历了完全相同的问题。于是我开始浏览Android源$ C ​​$ C,并作为原来唐的猜测大约有org.apache.commons的实现机器人。code.binary是正确的。他错了即将访问的能力,你可以,但Apache的百科全书,其1.2版本,而不是1.4版甚至1.5。 你可以看到在Android你的自我<一个href="https://android.googlesource.com/platform/external/apache-http/+/master/src/org/apache/commons/$c$cc/binary/Base64.java"相对=nofollow>来源。

I experienced the exact same problem. So i started browsing the android source code, and as it turns out Don's guess about Android having an implementation of org.apache.commons.code.binary is correct. he's wrong about the ability to access it, you can, but its version 1.2 of the apache commons, not version 1.4 or even 1.5. You can see for your self in the android source.

另外,作为一个说明,这个问题是的副本这一职务。

Also as a note, this question is a duplicate of this post.

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

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