{"record":{"id":"117e79536e8437a3","repo":"skylot/jadx","slug":"jdwp-handshake-failed","errorCode":null,"errorMessage":"jdwp handshake failed","messagePattern":"jdwp handshake failed","errorType":"exception","errorClass":"SmaliDebuggerException","httpStatus":null,"severity":"error","filePath":"jadx-gui/src/main/java/jadx/gui/device/debugger/SmaliDebugger.java","lineNumber":644,"sourceCode":"\t\t\t\ttryThrowError(res);\n\t\t\t\tif (res.isReplyPacket() && res.getID() == 1) {\n\t\t\t\t\tJDWP.IDSizes.IDSizesReplyData sizes = JDWP.IDSizes.decode(res.getBuf(), JDWP.PACKET_HEADER_SIZE);\n\t\t\t\t\treturn new JDWP(sizes);\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (IOException e) {\n\t\t\tthrow new SmaliDebuggerException(e);\n\t\t}\n\t\tthrow new SmaliDebuggerException(\"Failed to init JDWP.\");\n\t}\n\n\tprivate static void handShake(OutputStream outputStream, InputStream inputStream) throws SmaliDebuggerException {\n\t\tbyte[] buf;\n\t\ttry {\n\t\t\toutputStream.write(JDWP.encodeHandShakePacket());\n\t\t\tbuf = IOUtils.readNBytes(inputStream, 14);\n\t\t} catch (Exception e) {\n\t\t\tthrow new SmaliDebuggerException(\"jdwp handshake failed\", e);\n\t\t}\n\t\tif (buf == null || !JDWP.decodeHandShakePacket(buf)) {\n\t\t\tthrow new SmaliDebuggerException(\"jdwp handshake bad reply\");\n\t\t}\n\t}\n\n\tprivate MethodsWithGenericData getMethodBySig(long classID, String sig) {\n\t\tList<MethodsWithGenericData> methods = clsMethodMap.get(classID);\n\t\tif (methods != null) {\n\t\t\tfor (MethodsWithGenericData method : methods) {\n\t\t\t\tif (sig.startsWith(method.name + \"(\") && sig.endsWith(method.signature)) {\n\t\t\t\t\treturn method;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn null;\n\t}\n","sourceCodeStart":626,"sourceCodeEnd":662,"githubUrl":"https://github.com/skylot/jadx/blob/e738a26571d02919f01df40de93bc9a44dee4e18/jadx-gui/src/main/java/jadx/gui/device/debugger/SmaliDebugger.java#L626-L662","documentation":"Error \"jdwp handshake failed\" thrown in skylot/jadx.","triggerScenarios":"Thrown at jadx-gui/src/main/java/jadx/gui/device/debugger/SmaliDebugger.java:644 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Confirm the bytes sent match the 'JDWP-Handshake' string and that the socket is connected before writing; log the actual reply length when it differs.","Add a timeout on the handshake read so a hung target fails fast with a clear timeout error instead of a generic handshake failure."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e738a26571d02919f01df40de93bc9a44dee4e18","analyzedAt":"2026-08-14T00:10:24.238Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}