Skip to content

Instantly share code, notes, and snippets.

@pyeongho
Created April 11, 2019 05:44
Show Gist options
  • Save pyeongho/20bc05ab4648c13cf29d2fb7eff583ad to your computer and use it in GitHub Desktop.
Save pyeongho/20bc05ab4648c13cf29d2fb7eff583ad to your computer and use it in GitHub Desktop.
root_tcpip.java
public static void tAdbTcpip() {
Thread t = new Thread(() -> {
try {
Process proc = Runtime.getRuntime()
.exec(new String[]{ "su", "-c", "setprop service.adb.tcp.port 5555" });
proc.waitFor();
proc = Runtime.getRuntime()
.exec(new String[]{ "su", "-c", "stop adbd" });
proc.waitFor();
proc = Runtime.getRuntime()
.exec(new String[]{ "su", "-c", "start adbd" });
proc.waitFor();
} catch (Exception e) {
log.e(e.getMessage());
}
});
t.start();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment