Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Android Studio provides several tools needed in Greenspector Studio, as:

Installation

Download the last version on Android website:

  • Choose Download Android Studio [Version]

Image1.png
  • Scroll below and check I have read and agree with the above terms and conditions

Image2.png
  • Click on Download Android Studio [...] for Windows

The downloaded file has the format android-studio-[version_date]-windows.exe.

  • Install Android Studio with default settings and launch it

  • Keep Do not import settings selected and press ok

We will now install only useful components. On the welcome wizard:

Image3.png
  • Click on Next and select Custom setup

  • Confirm and accept all licences agreements

  • Uncheck the following components:

    • Performance (Intel HAXM)

    • Performance (Android Emulator hypervisor driver)

    • Android Virtual Device

Image4.png
  • Continue the installation

You should arrive on the welcome page. New components are now downloaded and installed. We need an extra item for UIAutomatorViewer:

Image5.png
  • Select More actions and SDK Manager

  • Choose SDK Tools and uncheck Hide Obsolete Packages

  • Search for Android SDK Tools (Obsolete) 26.1.1 and confirm installation

Image6.png

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.

  • In Start Menu, launch Run (hotkey Windows+R) and type %LocalAppData%

Image7.png
  • Browse in Android and Sdk folder

We will now verify if we have every tools we need:

  • Check for presence of aapt in folder build-tools/34.0.0

  • Check for presence of adb in folder platform-tools

  • Check for presence of uiautomatorviewer in folder tools/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.

  • In Start Menu, launch Run again (hotkey Windows+R) and type SystemPropertiesAdvanced

Image8.png
  • Select Environment Variables...

Image9.png
  • In section User variables for [USER], add variables with New...

Please do not edit System variables

Variable name:

Variable value:

ANDROID_HOME

%LocalAppData%\Android\Sdk

JAVA_HOME

C:\Program Files\Android\Android Studio\jbr

Image24.png
  • Still in section User variables for [USER], select line Path and click on Edit...

  • With New, add the following lines, one by one

%ANDROID_HOME%\build-tools\34.0.0
%ANDROID_HOME%\platform-tools
%JAVA_HOME%\bin

Please report the version number previously noted for build-tools.

Verification

Once environments variables are set, new tools can be tested from everywhere:

  • Open a new terminal, in Start Menu with command prompt or in Run (Windows+R) with cmd

Image20.pngImage21.png

  • Test adb with the following command:

adb --version

You should see the following result:

Image22.png
  • Test aapt with the following command:

aapt v

You should see the following result:

Image23.png

UIAutomatorViewer

We didn’t had directly path to UiAutomatorViewer. Indeed, this tools need a precise Java version to run. To avoid this extra installation, we will link it to integrated java installation of Android Studio via a command.

Method 1 : Get prepared file

In this method, simply get the prepared .bat file to run UiAutomatorViewer with the right Java location.

UIAutomatorViewer windows should appear.

Image0.jpg

Method 2 : Create your own script

  • Open a new terminal in Start Menu, by searching command prompt. You can also access to command prompt by typing cmd in Run (Windows+R)

  • Try the following command:

java -Xmx1600M -Dcom.android.uiautomator.bindir="%ANDROID_HOME%\tools" -cp "%ANDROID_HOME%\tools\lib\x86_64\swt.jar";"%ANDROID_HOME%\tools\lib\*" com.android.uiautomator.UiAutomatorViewer

UiAutomatorViewer should be able to start and appears. This command is not easy to use neither to remember so we will create a shortcut.

  • In Start Menu, open Notepad

  • Copy the previous command line inside the file

  • Click on File/Save As... and choose a location

  • Change file name with uiautomatorviewer.bat: extension format .bat is important

  • Try to open your new file and verify UiAutomatorViewer is correctly working

Optional: To be able to run quickly UIAutomatorViewer from Start Menu:

  • On desktop, create a shortcut to uiautomatorviewer.bat with right click, New, Shortcut

  • Name it UIAutomatorViewer

  • Open folder C:\ProgramData\Microsoft\Windows\Start Menu\Programs

  • Move the shortcut to the folder

UIAutomatorViewer will appear soon in Start Menu list.

Image12.png

  • No labels