UPDATE 29 AUG 2024
Android Studio provides several tools needed in Greenspector Studio, as:
Android Debug Bridge (ADB) and Android Asset Packaging Tool (AAPT) to establish communication between mobile device and computer
UiAutomatorViewer allows to analyse an Android view on a connected device. These information show what Greenspector Studio sees and are useful to create automated users journeys.
Installation
Download the last version on Android website:
Choose
Download Android Studio [Version]
Scroll below and check
I have read and agree with the above terms and conditions
Select the button for your Mac chip. You can find your Mac chip at the following location: Apple menu > About This Mac > Processor
Double click on the downloaded dmg file
Drap the Android Studio app to the Applications folder
Go to the Applications folder and double click on the Android Studio app
We will now install only useful components. On the welcome wizard:
Click on
Next
and selectCustom
setupConfirm and accept all licences agreements
Uncheck the following component:
Android Virtual Device
Continue the installation
You should arrive on the welcome page. New components are now downloaded and installed. We need an extra item for UIAutomatorViewer:
Select
More actions
andSDK Manager
Choose
SDK Tools
and uncheckHide Obsolete Packages
Search for
Android SDK Tools (Obsolete) 26.1.1
and confirm installation
Environment variables
Android Studio is now installed on computer. However, it’s not known by OS as environment variables: tools are launchable only in their installation folder, which isn’t practical for Greenspector Studio uses.
Open the following folder:
$HOME/Library/Android/sdk
We will now verify if we have every tools we need:
Check for presence of
aapt
in folderbuild-tools/34.0.0
Check for presence of
adb
in folderplatform-tools
Check for presence of
uiautomatorviewer
in foldertools/bin
Please note build-tools version number for a further step.
These tools are now installed, but they are not yet ready to be executed everywhere in the system. We will add their location to the PATH
to indicate to our system where they are.
Edit the .bash_profile file with the following content:
# Android Studio tools export ANDROID_HOME=$HOME/Library/Android/sdk export JAVA_HOME=/Applications/Android\ Studio.app/Contents/jbr export PATH=$ANDROID_HOME/build-tools/35.0.0:$PATH export PATH=$PATH:$ANDROID_HOME/platform-tools export PATH=$PATH:$ANDROID_HOME/tools/bin export PATH=$JAVA_HOME/bin:$PATH
Update the changes with the following command:
source ~/.bash_profile
Verification
Once environments variables are set, new tools can be tested from everywhere:
Test
adb
with the following command:
adb --version
You should see the following result:
Test
aapt
with the following command:
aapt v
You should see the following result:
UIAutomatorViewer
On macOS, you need to install Java 1.8.
On Mac with Intel chip, run the command below, add the line
export PATH=/usr/local/opt/openjdk@8/bin:$PATH
in the .bash_profile file and run the command "source ~/.bash_profile":
brew install openjdk@8
On Mac with Mac chip, run the commands below, add the line
export PATH=/Library/Java/JavaVirtualMachines/temurin-8.jdk/Contents/Home/bin:$PATH
in the .bash_profile file and run the command "source ~/.bash_profile"
brew tap homebrew/cask-versions brew install --cask temurin@8
Launch UIAutomatorViewer:
uiautomatorviewer
The following program appears:
On macOS, interactions may be impossible with UIAutomatorViewer.
If it is the case, do the following steps:
Download swt here: https://www.eclipse.org/downloads/download.php?file=/eclipse/downloads/drops4/R-4.20-202106111600/swt-4.20-cocoa-macosx-x86_64.zip
Extract the folder and open it
Rename swt.jar file to swt2.jar
Copy the file in the following folder: $HOME/Library/Android/sdk/tools/lib/x86_64
Launch UIAutomatorViewer and resize the window
With some Mac, you also have to create a folder called aarch64 next to the folder called x86_64. Then, you have to copy the swt2.jar file into the new folder.