
Now, i open android studio, and from my app code i create an object for my adb class which has the following code, So i m doing adb start-server -a and i ran adb devices from my pc, it displayed my device You can start it by running adb once from the command line. ?Įarlier I tried ProcessBuilder, that did not work.įrom the docs, i saw Make sure the adb server is running. My question is will i be able to run adb command from/inside an android app like i m trying to do here. Using it is easy type adb shell An example would be changing permissions on a file like so: adb shell chmod666 /sdcard/somefile.īe very careful running direct commands using these methods.Īnd there you have it. The other method of using the adb shell command is using it to tell your phone to run a shell command without going into the shell. ** It is not DOS so don't try any DOS commands.** They allow you to interact with your phone through typed commands and a lot of folks use one or both on their Linux or Mac computers even if they didn't know it. I'll warn you that unless you're familiar with an ash or bash shell, you need to be careful here because things can turn south quickly if you're not. Once inside, you can interact with the actual running operating system on your phone. Getting there is easy enough, just type adb shell and enter. In the image above, I'm inside the device shell. There are two ways to use it, one where you send a command to the device to run in its own command-line shell, and one where you actually enter the device's command shell from your terminal. The adb shell command confuses a lot of folks. Source: Jerry Hildenbrand / Android Central (Image credit: Source: Jerry Hildenbrand / Android Central)
