-
Notifications
You must be signed in to change notification settings - Fork 97
Setup
- Python 3
- Linux or macOS
Current and former contributors have used Ubuntu 18.04 and Ubuntu 20.04 along with Python 3.6.9 and 3.7.4.
- Click on the Fork icon in the top right hand corner once you're logged into Github.
- Once it finishes loading, click on the green Code button. Copy
git clone [email protected]:[your_username]/android-runner.git
and then paste that into your terminal after navigating to the desired local development environment. - Type
cd android-runner
to enter the framework's main directory. Now, add a remote tracker to the parent repository withgit remote add upstream https://github.com/S2-group/android-runner
. This is useful in case any major changes occur to the parent directory that may affect your project.git remote -vv
should now show origin and upstream. - Create a virtual environment:
python3 -m venv /path/
. This can be anywhere on your machine. Activate it withsource /path/bin/activate
. - Install dependencies:
- Select your platform below:
- Install JDK 11
sudo apt install openjdk-11-jre
. - Download the
sdkmanager
from the latest "command line tools only" package available here and unzip the package to your$HOME
directory. - Create a directory called
android-sdk
in your$HOME
directory and move the unzippedcmdline-tools
directory there. - In the directory
cmdline-tools
create a sub-directory calledlatest
. - Move all the original contents from
cmdline-tools
into the newly createdlatest
directory. - cd into
cmdline-tools/latest/bin
and run the following commands to install adb and monkeyrunner:
./sdkmanager "platform-tools" ./sdkmanager "build-tools;30.0.0"
- Add the following to your
.bashrc
or.zshrc
file:
export PATH=$HOME/android-sdk/cmdline-tools/latest/bin:$PATH export PATH=$HOME/android-sdk/platform-tools:$PATH export PATH=$HOME/android-sdk/tools/bin:$PATH
- Reload your
.bashrc
or.zshrc
settings by runningsource ~/.bashrc
orsource ~/.zshrc
- To verify if everything works correctly run
adb --version
. This should return its version number and install location. To do the same for Monkey Runner runmonkeyrunner --version
. This should return aUnrecognized argument: --version
. but no other errors. - Install lxml using
sudo apt install python3-lxml
(assuming python3 is being used).
- Android Debug Bridge (
sudo apt install android-tools-adb
) - Android SDK Tools (
sudo apt install monkeyrunner
) - JDK 11 (
sudo apt install openjdk-11-jre
)- See this for switching between java versions
- lxml (
sudo apt install python-lxml
)
-
Download Android Studio from here.
-
Extract the archive,
cd
into its directory and install Android Studio by running./bin/studio.sh
-
During the setup wizard Android Studio will ask you where you want to install the Android SDK. By default it is in
/home/user/Android/Sdk
-
The Android SDK, including ADB and Monkey Runner, is now installed on your system. To access the Android tools directly via your shell (preferable) add the following to your .bashrc/.zshrc:
export ANDROID_HOME=$HOME/Android/Sdk export PATH=$PATH:$ANDROID_HOME/tools/bin export PATH=$PATH:$ANDROID_HOME/platform-tools
-
Reload your
.bashrc
or.zshrc
settings by runningsource ~/.bashrc
orsource ~/.zshrc
-
Since MonkeyRunner requires JDK 8 (not JDK 9) we need to install JDK 8:
sudo apt install openjdk-8-jre
.- Once JDK 8 is installed we need to actually set it as default. See here how to do that.
-
To verify if everything works correctly run
adb --version
. This should return its version number and install location. To do the same for Monkey Runner runmonkeyrunner --version
. This should return aUnrecognized argument: --version.
but no other errors. -
Install lxml using
sudo apt install python-lxml
.
- Make sure you have Homebrew installed
brew install --cask homebrew/cask-versions/adoptopenjdk8 android-sdk android-platform-tools
brew install libxml2
- Run
java -version
, if you are running a different version than 1.8/8: -
brew install jenv
- Run
/usr/libexec/java_home -V
to see the location of your Java environments - Copy the location of your AdoptOpenJDK8 environment
- Run
jenv add <AdoptOpenJDK8_path>
- Run
jenv global 1.8
- Restart terminal and verify your Java version with
java -version
, it should outputopenjdk version "1.8.0_265"
- Run
- Verify that monkeyrunner works with
monkeyrunner --version
, it should output unrecognized argument and no other errors
- Install JDK 11
- Within Android Runner's main directory
pip install -r requirements.txt
- For creating or editing unit tests to ensure pull request passes TravisCI
pip install pytest mock
- Select your platform below:
Note: It is important that Monkeyrunner shares the same adb the experiment is using. Otherwise, there will be an adb restart and output may be tainted by the notification. You can specify the path to adb and/or Monkeyrunner in the experiment configuration file.
Note 2: The Batterystats, Trepn and Monsoon plugins have additional dependencies. Refer to the plugin READMEs for more information.