...
if ANDROID_HOME variable is not set, referer to the table below.
If you have en error and uiautomatorviewer does not open, this is probably because uiautomatorviewer is configured to use by default java JDK version 1.8
...
Default path for windows | Default path for Linux | ||
---|---|---|---|
ANDROID_HOME | add this variable to precise the path on the sdk android | c:\Users\USER\AppData\Local\Android\Sdk | $home\android\sdk |
JAVA_HOME | add this variable to set the path to the JDK. you can use the jdk installed by android studio | c:\Program Files\Android\Android Studio\jbr if jbr is not present (old version Android Studio, replace by jre) | $home\android-studio\jbr if jbr is not present (old version Android Studio, replace by jre) |
PATH | Complete the path by adding the path to directory containing the java executable. | %JAVA_HOME%\bin | $JAVA_HOME\bin |
...
After adding the variables, you can open a new terminal (this is important to open a new terminal to take into account the variable you have just set) and use the following command to open uiautomatorviewer :
For windows :
Code Block |
---|
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 |
For linux :
Code Block |
---|
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 |
Pour lancer uiautomatorviewer, ouvrir un terminal de commande et aller dans le répertoire $ANDROID_HOME/tools/bin et taper le nom de l'éxécutable présent dans le répertoire (uiautomatorviewer ou uiautomatorviewer.bat en fonction de votre OS …)
...