Solve the problem of introducing Codec.jar packet error in Android project

Source: Internet
Author: User

The hex.encodehexstring (byte[] input) method under the Org.apache.commons.codec.jar package is used for encryption in Android projects. The result is compiled, and the runtime is always reported java.lang.NoSuchMethodError:org.apache.commons.codec.binary.Hex.encodeHexString ([B) ljava/lang/ String; error.

Reason: Google Android also has a package name of the same project, and the same class name, the key point is not the method! Therefore, the package name conflict, because of the Java call mechanism, the system first found in its own inside the same name of this class, and then to call the system itself the method under the class. However, the system does not have that method at all, so error.

Solution: Use Eclipse to download the source code, repackage it, modify the original package name, and then re-introduce it to the project.

Solve the problem of introducing Codec.jar packet error in Android project

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.