skylot/jadx · error · SmaliDebuggerException

Attach failed

Error message

Attach failed

What it means

Error "Attach failed" thrown in skylot/jadx.

Source

Thrown at jadx-gui/src/main/java/jadx/gui/device/debugger/SmaliDebugger.java:158

			byte[] bytes = JDWP.IDSizes.encode().getBytes();
			JDWP.setPacketID(bytes, 1);
			LOG.debug("Connecting to ADB {}:{}", host, port);
			Socket socket = new Socket(host, port);
			InputStream inputStream = socket.getInputStream();
			OutputStream outputStream = socket.getOutputStream();

			socket.setSoTimeout(5000);
			JDWP jdwp = initJDWP(outputStream, inputStream);
			socket.setSoTimeout(0); // set back to 0 so the decodingLoop won't break for timeout.

			SmaliDebugger debugger = new SmaliDebugger(suspendListener, port, jdwp, inputStream, outputStream);

			debugger.decodingLoop();
			debugger.listenClassUnloadEvent();
			debugger.initPools();
			return debugger;
		} catch (IOException e) {
			throw new SmaliDebuggerException("Attach failed", e);
		}
	}

	private void onSuspended(long thread, long clazz, long mth, long offset) {
		suspendInfo.update()
				.updateThread(thread)
				.updateClass(clazz)
				.updateMethod(mth)
				.updateOffset(offset);
		if (suspendInfo.isAnythingChanged()) {
			SUSPEND_LISTENER_QUEUE.execute(() -> suspendListener.onSuspendEvent(suspendInfo));
		}
	}

	public void stepInto() throws SmaliDebuggerException {
		sendStepRequest(suspendInfo.getThreadID(), JDWP.StepDepth.INTO);
	}

View on GitHub (pinned to e738a26571)

Solutions

  1. Check that the target device/emulator is reachable and the debuggable process is running before attaching; surface the underlying IOException cause to the user.
  2. Retry the attach after verifying the ADB forward port is still open, and fail with instructions to restart ADB if the connection was refused.

When it happens

Trigger: Thrown at jadx-gui/src/main/java/jadx/gui/device/debugger/SmaliDebugger.java:158 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of skylot/jadx@e738a26571 (2026-08-14). Data as JSON: /api/errors/2c43852ad8a63a3f. Report an issue: GitHub.