I’m putting together a bunch of bash scripts that I use while developing Android apps with Android Studio. This first script will iterate through each relevant line that is outputted from the adb devices command. So if multiple devices are connected to adb, then all are listed. I’m using the -e argument with grep to search for the patterns that I want returned. The example below will return manufacture, model and processor information for each device.

All scripts can be downloaded from my GitHub Android-Utility-Bash-Scripts

Note that the environment variable named ANDROID_HOME must be set to the Android SDK path. On Mac OS X this is usually based off the user path from the Library:

~/Library/Android/sdk

Full path would be:

/Users/your-username/Android/sdk

So before running this script open your ~/.bash_profile and add the following line:

export ANDROID_HOME=/Users/your-username/Library/Android/sdk

Make sure to put in your relevant username in the above path. After you have downloaded the repo you can run the following by executing:

sh adb-list-device-architectures.sh


echo "List Device Architectures..."

# get full path to adb just in case script gets confused
ADBPATH="${ANDROID_HOME}/platform-tools"

for SERIAL in $(adb devices | tail -n +2 | cut -sf 1);
do
echo "**** Device Serial Number -> $SERIAL Architecture *****";
adb -s $SERIAL shell getprop | grep -e manufacturer -e model -e abi
echo "**** END $SERIAL ****";
echo "\r\n";
done

echo "***** End List Device Architecture *****"

One Response so far.

Leave a Reply