pxb1988/dex2jar · error · NoSuchMethodException
can't find method
Error message
can't find method
What it means
During setup DecryptStringCmd resolves each configured method (owner/name/desc) on the loaded classes to a reflective java.lang.reflect.Method, walking up the class hierarchy. If no matching method exists it throws NoSuchMethodException naming the missing member.
Solutions
- Verify the method name and descriptor in the config match the actual jar (use javap -p)
- Confirm the owner class exists in the input jar and isn't obfuscated/renamed
- Include dependency jars so parent classes can be loaded when the method is inherited
- Fix the config line's name/desc to the real signature
Example fix
// before (config) Lcom/foo/Bar;->decrypt(Ljava/lang/String;)Ljava/lang/String; // after (matching real signature via javap) Lcom/foo/Bar;->a(Ljava/lang/String;)Ljava/lang/String;
Defensive patterns
Strategy: try-catch
Validate before calling
// Pre-check via reflection before configuring
Class<?> c = Class.forName(owner.replace('/', '.'), false, loader);
boolean found = java.util.Arrays.stream(c.getMethods()).anyMatch(m -> m.getName().equals(name) && Type.getMethodDescriptor(m).equals(desc)); Try / catch
try { setupConfigs(configs); } catch (NoSuchMethodException e) { log.error("Config points to missing method: " + e.getMessage()); configErrorExit(); } Prevention
- Cross-check config entries against `javap -p` output of the actual jar
- Re-derive configs after obfuscation/renaming changes
- Include dependency jars on the tool's classpath for inherited methods
When it happens
Trigger: A config entry's owner class doesn't contain (nor inherit) a method with exactly the configured name and descriptor — e.g. the class is missing from the jar, obfuscated/renamed, or the descriptor typo'd.
Common situations: Pointing the tool at an obfuscated APK jar where method names were renamed, or targeting a method from a library dependency not present in the scanned classpath.
Related errors
AI-assisted analysis of pxb1988/dex2jar@b5bda4fb49 (2026-09-08).
Data as JSON: /api/errors/ebbda09460836478.
Report an issue: GitHub.
Appendix: source
Thrown at dex-tools/src/main/java/com/googlecode/dex2jar/tools/DecryptStringCmd.java:835
for (MethodConfig config : methodConfigs) {
Method jmethod;
try {
Class<?> clz = cl.loadClass(config.owner.replace('/', '.'));
if (clz == null) {
System.err.println("clz is null:" + config.owner);
}
jmethod = findAnyMethodMatch(clz, config.name,
toJavaType(Type.getArgumentTypes(config.desc)));
} catch (Exception ex) {
System.err.println("can't load method: L" + config.owner + ";->" + config.name + config.desc);
throw ex;
}
if (jmethod != null) {
jmethod.setAccessible(true);
config.jmethod = jmethod;
map.put(config, config);
} else {
throw new NoSuchMethodException("can't find method " + config.name + config.desc + " on class " + config.owner + " or its parent");
}
}
return map;
}
/**
* collect methods from --methods and --method-owner,--method-name
*
* @return
* @throws IOException
*/
private List<MethodConfig> collectMethodConfigs() throws IOException {
List<MethodConfig> methodConfigs = new ArrayList<>();
if (this.method != null) {
for (String line : Files.readAllLines(this.method, StandardCharsets.UTF_8)) {
if (line.length() == 0 || line.startsWith("#")) {
continue;
}View on GitHub (pinned to b5bda4fb49)