This question already has answers here:
Method not found using DigestUtils in Android
                                
                                    (8个答案)
                                
                        
                                6年前关闭。
            
                    
我正在使用此进行一些加密

String encodedString = Hex.encodeHexString(s.getBytes("ISO-8859-1"));



我已经在Android中使用commons-codec-1.8.jar。

显示错误

06-21 12:43:04.309: E/AndroidRuntime(1667): Caused by: java.lang.NoSuchMethodError: org.apache.commons.codec.binary.Hex.encodeHexString


请帮忙。

最佳答案

尝试

String encodedString = new String(Hex.encodeHex(s.getBytes("ISO-8859-1")));

07-24 21:24