Created
April 27, 2020 06:44
-
-
Save milis92/5f5405e426018b08506424f9338bc5aa to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| task getDeviceIp { | |
| doLast { | |
| new ByteArrayOutputStream().withStream { os -> | |
| exec { | |
| commandLine(android.getAdbExe()) | |
| args('shell', 'ip', 'addr', 'show', 'wlan0', ' | grep', '\'inet \'', '| cut -d\' \'', '-f6', '|cut -d/', '-f1') | |
| standardOutput = os | |
| } | |
| ext.deviceIp = os.toString().trim() | |
| } | |
| } | |
| } | |
| task enableWifyDebug { | |
| dependsOn getDeviceIp | |
| doFirst { | |
| exec { | |
| commandLine(android.getAdbExe()) | |
| args('tcpip', '5555') | |
| } | |
| } | |
| doLast { | |
| exec { | |
| commandLine(android.getAdbExe()) | |
| args('connect', getDeviceIp.deviceIp) | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment