{"record":{"id":"222fd7b27d07fa34","repo":"skylot/jadx","slug":"failed-to-init-jdwp","errorCode":null,"errorMessage":"Failed to init JDWP.","messagePattern":"Failed to init JDWP\\.","errorType":"exception","errorClass":"SmaliDebuggerException","httpStatus":null,"severity":"error","filePath":"jadx-gui/src/main/java/jadx/gui/device/debugger/SmaliDebugger.java","lineNumber":635,"sourceCode":"\t\ttry {\n\t\t\thandShake(outputStream, inputStream);\n\t\t\toutputStream.write(JDWP.Suspend.encode().setPacketID(1).getBytes()); // suspend all threads\n\t\t\tPacket res = readPacket(inputStream);\n\t\t\ttryThrowError(res);\n\t\t\tif (res.isReplyPacket() && res.getID() == 1) {\n\t\t\t\t// get id sizes for decoding & encoding of jdwp packets.\n\t\t\t\toutputStream.write(JDWP.IDSizes.encode().setPacketID(1).getBytes());\n\t\t\t\tres = readPacket(inputStream);\n\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) {","sourceCodeStart":617,"sourceCodeEnd":653,"githubUrl":"https://github.com/skylot/jadx/blob/e738a26571d02919f01df40de93bc9a44dee4e18/jadx-gui/src/main/java/jadx/gui/device/debugger/SmaliDebugger.java#L617-L653","documentation":"Error \"Failed to init JDWP.\" thrown in skylot/jadx.","triggerScenarios":"Thrown at jadx-gui/src/main/java/jadx/gui/device/debugger/SmaliDebugger.java:635 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the socket connection to the JDWP transport succeeded before initializing; include the underlying exception message in the thrown error.","Ensure the JDWP handshake is performed on the correct forwarded port and that no other debugger is already attached to the process."],"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"}