1. <tfoot id='x6k2s'></tfoot>

      <legend id='x6k2s'><style id='x6k2s'><dir id='x6k2s'><q id='x6k2s'></q></dir></style></legend>
      <i id='x6k2s'><tr id='x6k2s'><dt id='x6k2s'><q id='x6k2s'><span id='x6k2s'><b id='x6k2s'><form id='x6k2s'><ins id='x6k2s'></ins><ul id='x6k2s'></ul><sub id='x6k2s'></sub></form><legend id='x6k2s'></legend><bdo id='x6k2s'><pre id='x6k2s'><center id='x6k2s'></center></pre></bdo></b><th id='x6k2s'></th></span></q></dt></tr></i><div id='x6k2s'><tfoot id='x6k2s'></tfoot><dl id='x6k2s'><fieldset id='x6k2s'></fieldset></dl></div>
        <bdo id='x6k2s'></bdo><ul id='x6k2s'></ul>

      <small id='x6k2s'></small><noframes id='x6k2s'>

    2. Apache Commons Codec with Android:找不到方法

      时间:2024-04-14

      1. <legend id='wCxca'><style id='wCxca'><dir id='wCxca'><q id='wCxca'></q></dir></style></legend>
        • <bdo id='wCxca'></bdo><ul id='wCxca'></ul>
        • <i id='wCxca'><tr id='wCxca'><dt id='wCxca'><q id='wCxca'><span id='wCxca'><b id='wCxca'><form id='wCxca'><ins id='wCxca'></ins><ul id='wCxca'></ul><sub id='wCxca'></sub></form><legend id='wCxca'></legend><bdo id='wCxca'><pre id='wCxca'><center id='wCxca'></center></pre></bdo></b><th id='wCxca'></th></span></q></dt></tr></i><div id='wCxca'><tfoot id='wCxca'></tfoot><dl id='wCxca'><fieldset id='wCxca'></fieldset></dl></div>
            <tbody id='wCxca'></tbody>
          • <small id='wCxca'></small><noframes id='wCxca'>

                <tfoot id='wCxca'></tfoot>
                本文介绍了Apache Commons Codec with Android:找不到方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                今天我尝试在我的 Android 应用程序中包含 apache.commons.codec 包,但无法运行.Android 找不到方法 ord.apache.commons.codec.binary.* 并在 DDMS 中输出以下错误

                Today I tried including the apache.commons.codec package in my Android application and couldn't get it running. Android could not find method ord.apache.commons.codec.binary.* and output the following errors in DDMS

                01-12 08:41:48.161: 错误/dalvikvm(457): 找不到方法 org.apache.commons.codec.binary.Base64.encodeBase64URLSafeString,引用自方法 com.dqminh.app.util.Util.发送请求

                01-12 08:41:48.161: ERROR/dalvikvm(457): Could not find method org.apache.commons.codec.binary.Base64.encodeBase64URLSafeString, referenced from method com.dqminh.app.util.Util.sendRequest

                01-12 08:41:48.161: WARN/dalvikvm(457): VFY: 无法解析静态方法 10146: Lorg/apache/commons/codec/binary/Base64;.encodeBase64URLSafeString ([B)Ljava/lang/字符串;

                01-12 08:41:48.161: WARN/dalvikvm(457): VFY: unable to resolve static method 10146: Lorg/apache/commons/codec/binary/Base64;.encodeBase64URLSafeString ([B)Ljava/lang/String;

                01-12 08:41:48.161: WARN/dalvikvm(457): VFY: 在 0x0004 拒绝操作码 0x71

                01-12 08:41:48.161: WARN/dalvikvm(457): VFY: rejecting opcode 0x71 at 0x0004

                关于如何解决这个问题的任何线索?非常感谢.

                Any clue on how to solve this problem ? Thanks a lot.

                推荐答案

                我在使用带有 的 android 时遇到了类似的问题OAuth 库 我正在开发.

                I had a similar problem while using android with an OAuth library I'm developing.

                我也从 android 得到,虽然我在类路径中包含了 apache.commons.codec,但没有找到特定的方法 (encodeBase64String).

                I also got from android that, although I had included apache.commons.codec in the classpath, a particular method (encodeBase64String) was not found.

                检查 javadocs,这两种方法都声称是 1.4 和更高版本,所以我的猜测是 android 已经包含这些方法所在的旧版本的 commons.codec确实未定义.

                Checking the javadocs, both methods claim to be 1.4 and greater only, so my guess is that android already includes an older version of commons.codec where these methods are indeed undefined.

                我的解决方案是使用较旧的方法,如下所示:

                My solution was to use an older method, like this:

                String encodedString = new String(Base64.encodeBase64('string to encode'));
                

                您要使用的方法不同,因为它将 + 和/替换为 url 安全值 - 和 _.所以你可能会使用类似的东西:

                The method you want to use is different since it replaces + and / with url-safe values - and _. So you probably might use something like:

                String encodedString = new String(Base64.encodeBase64('string to encode'));
                String safeString = encodedString.replace('+','-').replace('/','_');
                

                希望有帮助!

                这篇关于Apache Commons Codec with Android:找不到方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:将 NSData 转换为 base64 下一篇:Android中base64字符串编码和解码位图对象

                相关文章

                • <bdo id='9QMRw'></bdo><ul id='9QMRw'></ul>

                  <i id='9QMRw'><tr id='9QMRw'><dt id='9QMRw'><q id='9QMRw'><span id='9QMRw'><b id='9QMRw'><form id='9QMRw'><ins id='9QMRw'></ins><ul id='9QMRw'></ul><sub id='9QMRw'></sub></form><legend id='9QMRw'></legend><bdo id='9QMRw'><pre id='9QMRw'><center id='9QMRw'></center></pre></bdo></b><th id='9QMRw'></th></span></q></dt></tr></i><div id='9QMRw'><tfoot id='9QMRw'></tfoot><dl id='9QMRw'><fieldset id='9QMRw'></fieldset></dl></div>
                1. <legend id='9QMRw'><style id='9QMRw'><dir id='9QMRw'><q id='9QMRw'></q></dir></style></legend>

                  <small id='9QMRw'></small><noframes id='9QMRw'>

                  <tfoot id='9QMRw'></tfoot>