Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
We don't have a way to export this macro.
Table of Contents

You can use an android emulator to help you develop your GDSL tests. It is usefull if you do not have a real device or if you want to test on a device with the same resolution as a device on the Test Bench. Do not use emulator if you want measures, the metrics (energy, data …) are not available.

...

  • 16 GB of RAM memory

  • Available Disk storage > 10 GB

  • Install Android StudioInstall Java on Linux

  • On Windows only, turn vulkan off to be able to load web pages (only if you want to test web pages) :

    • Open Windows start menu

    • Select Notepad

    • Add the following text :

      Code Block
      languagebash

...

    • Vulkan 

...

    • = 

...

    • off
      

...

    • GLDirectMem 

...

  • Install Java on Windows:

    • Go to https://www.java.com/fr/download/help/windows_manual_download.html and install the Java executable

    • Click on the Java executable and follow the instructions

    • Add JAVA_HOME to your path / environment variables: Windows start menu > Settings > System > About > Advanced settings > Environment variables > Path > Modify > Add the path C:\Program Files (x86)\Java\jre-1.8

  • Install Android SDK Tools to have uiautomatorviewer from Android Studio:
    • = on
    • Click on File > Save as : go to C:\Users\[username]\.android and name the file advancedFeatures.ini

Info

On Windows, turning vulkan off may display a black screen on the emulator.

If it is the case, during the emulator creation, you will have to select “Graphics: Software - GLES 2.0”

1.2. Prerequisite to use an android emulator with Greenspector tools

  • Follow the first part of the prerequisite (part 1.1)

  • Install Android SDK Tools:

    • Install Android Studio if you don’t have it

    • Open Android Studio

    • Click on More Actions > SDK Manager (or Tools > SDK Manager if a project is open)

    • Click on the SDK Tools tab, uncheck "Hide Obsolete Packages"

    • Check Android SDK Tools and install version 26.1.1

  • Add sdkmanager ADB (Android Debug Bridge) to your path / environment variables:

  • Follow the first part of the prerequisite (part 1.1)

  • Add ADB (Android Debug Bridge) to your path /
    • On Linux: add the line export PATH=$HOME/Android/Sdk/platform-tools/bin:$PATH in the .bashrc file and run the command "source ~/.bashrc"

    • On Mac: add the line export PATH=$HOME/Library/Android/sdk/platform-tools/bin:$PATH in the .bash_profile file and run the command "source ~/.bash_profile"

    • On Windows: Windows start menu > Settings > System > About > Advanced settings > Environment variables > Path > Modify > Add the path C:\Users\[username]\AppData\Local\Android\Sdk\tools\bin

  • On Windows only, turn vulkan off to be able to load web pages (only if you want to test web pages) :

    • Open Windows start menu

    • Select Notepad

    • Add the following text :

      Code Block
      languagebash
      Vulkan = off
      GLDirectMem = on
    • Click on File > Save as : go to C:\Users\[username]\.android and name the file advancedFeatures.ini

Info

On Windows, turning vulkan off may display a black screen on the emulator.

If it is the case, during the emulator creation, you will have to select “Graphics: Software - GLES 2.0”

1.2. Prerequisite to use an android emulator with Greenspector tools

    • platform-tools. Replace username by the name of the user.

  • Add AAPT (Android Asset Packaging Tool) to your environment variables:

    • On Linux: add the line export PATH=$HOME/Android/Sdk/platformbuild-tools/[aapt_folder]:$PATH in the .bashrc file and run the command "source ~/.bashrc". Replace aapt_folder by the name of the aapt folder.

    • On Mac: add the line export PATH=$HOME/Library/Android/sdk/platformbuild-tools/[aapt_folder]:$PATH in the .bash_profile file and run the command "source ~/.bash_profile". Replace aapt_folder by the name of the aapt folder.

    • On Windows: Windows start menu > Settings > System > About > Advanced settings > Environment variables > Path > Modify > Add the path C:\Users\[username]\AppData\Local\Android\Sdk\platformbuild-tools\[aapt_folder]. Replace username by the name of the user and aapt_folder by the name of the aapt folder.

  • Get the testrunner from https://app.greenspector.com/ in the Modules tab, and put it in a folder (for example “testrunner_files”)

  • Add in this folder the configuration files config.yml and job.yml, and a script with the testgb extension. An example of these files is available at the following location:

    You can find the documentation about the gdsl functions here

Useful documentation :

2. Use an android emulator without Greenspector tools

...

  • Check the configuration and click on “Finish”. Be careful, the configuration might be different than the one you chose. Make sure to click on “Show Advanced Settings” and check each property.

  • Your device is now created. You can launch it by clicking on the triangle.

...

2.2. Emulators tested

Device Name

Screen Size

(inches)

Resolution

RAM

System image

Version Chrome

Computer OS

Samsung Galaxy S9

5,8

1080 x 2220

4 GB

Android 10.0 Google APIs | x86

113

Linux

Samsung Galaxy Tab A7

10,4

2000 x 1200

3 GB

Android 10.0 Google APIs | x86

114

Linux

Samsung Galaxy Tab S7 FE

12,4

2560 x 1600

4 GB

Android 10.0 Google APIs | x86_64

114

Linux

Samsung Galaxy S10

6,1

1080 x 2280

8 GB

Android 11.0 Google APIs | x86

Google Pixel C

10,2

2560 x 1800

3 GB

Android 8.1 Google APIs | x86

Info
  • If your computer is configured in English, you have to write the screen size with a dot (ex: 5.8).

  • Avoid using Android 13.0 system image. It takes for too many resources from your computer.

  • If you want to use a tablet emulator, you can uncheck the portrait mode to use only the landscape mode.

...

  • Open the configuration file of your emulator. Replace [device_id] by the id of your device.

    • On Linux and macOS: $HOME/.android/avd/[device_id]/config.ini

    • On Windows: C:\Users\[username]\.android\avd\[device_id]\config.ini

  • Make the following changes:

    • PlayStore.enabled: change from “false” to “true”

    • image.sysdir.1: change “google_apis” to “google_apis_playstore”

    • tag.display: change “Google APIs” to “Google Play”

    • tag.id: change “google_apis” to “google_apis_playstore”

  • Save your changes

  • On the Device Manager window, select the three dots button and click on “Wipe Data”. It will load the new configuration.

  • We expect the following error message:

...

Info

In some old

...

versions of Android Studio, you can have a direct download action instead of a warning missing system image. Please download. Then you do not need to do the following

...

actions to download manually the system image.

...

  • Go back to the welcome window of Android Studio

  • Click on the three dots button

  • Select SDK Manager

If you already have a project open on Android Studio, click on Tools > SDK Manager.

  • Click on the SDK Platforms tab

  • Check the Show Package Details box

  • Choose the system image that you want and download it. If you want the system image with Android 10 and Google Play Store:

...

languagebash

...

  • , select Android 10.0

...

  • (Q) - Google Play Intel x86 Atom System Image.

...

  • On the Device Manager window, select the three dots button and click on “Wipe Data”. It will load the new configuration. Then, you can launch the device with Google Play Store.

...

Code Block
languagebash
# For newer version of Android SDK
export PATH=$HOME/Android/Sdk/emulator:$PATH

# For older version of Android SDK
export PATH=$HOME/Android/Sdk/tools:$PATH
  • On macOS: Update ~/.bashrc or ~/.bash_profile

Code Block
languagebash
export PATH=$HOME/Library/Android/Sdk/emulator:$PATH

...

Code Block
languageyaml
job:
   url: com.google.android.youtubechrome

In the second case, it installs the app at the beginning of the test and uninstalls it at the end.

...

  • Launch an android emulator

    • Option 1: open the Device Manager window of Android Studio and click on the triangle

    • Option 2: start an emulator from the command line (part 2.5)

  • If you run the testrunner for the first time, you have to run it once without the --no-update option:

    • On Linux and macOS: ./testrunner -jobFile job.yml -config config.yml

    • On Windows: testrunner -jobFile job.yml -config config.yml

  • Download the android-service executable in 32 bits and its version file : https://dl.greenspector.com/emulator/android-service-files.tar.gz

  • Go to your greenspector cache:

    • On Linux and macOS: $HOME/.greenspector

    • On Windows: C:\Users\[username]\.greenspector

  • Replace the android-service and android-service.version files with the downloaded files. You will have to decompress the tar.gz file.

  • You can now run the testrunner with the --no-update option:

    • On Linux and macOS: ./testrunner -jobFile job.yml -config config.yml --no-update

    • On Windows: testrunner -jobFile job.yml -config config.yml --no-update

...

Info

On macOS, you may have the following warning:

"testrunner" cannot be opened because the developer cannot be verified.

To fix that accept the notification by clicking on Allow anyway in the Apple menu / System Settings > Privacy & Security

Info

On macOS with M1 chip, you may need to install Rosetta first:

/usr/sbin/softwareupdate --install-rosetta --agree-to-license