I use the Apache commons-codec-1.10.jar library in the application. I have a method:

 private static String hashLoginPassword(String user, String password, String sessionAttr) { return DigestUtils.sha1Hex(DigestUtils.sha1Hex(user.toLowerCase() + password) + sessionAttr); } 

When executed, the application crashes with the error:

 Caused by: java.lang.NoSuchMethodError: No static method encodeHexString([B)Ljava/lang/String; in class Lord/apache/commons/codec/binary/Hex; or its super classes (declaration of 'org.apache.commons.codec.binary.Hex' appears in /system/framework/ext.jar) at org.apache.commons.codec.digest.DigestUtils.sha1Hex(DigestUtils.java:438) 

I was looking for information on the Internet. If I understood correctly, many people write (who has a similar situation) that the problem is that the path is incorrectly determined. But my dancing with a tambourine did not eliminate the error. Help.

I use the same code not in Android Studio , but in Intellij Idea (Java SE) and everything works.

  • I use the same library version 1.6. No problems were observed. Do you need exactly 1.10? - Chubatiy
  • @Chubatiy Tried 1.6 - the same error. - Vladimir
  • Look depending, find the class org.apache.commons.codec.binary.Hex . And look for the encodeHexString method in it. Make sure you have it all in your final application. Maybe for some reason the collector does not include it or includes it, but the wrong version. Also try the simple Hex.encodeHexString(byte[] data) method. + Possible solution github.com/figo-connect/java-figo/blob/… - Chubatiy

0