Skip to content

mj-support/AndroidAgent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AndroidAgent: Task completion in Android OS using Reinforcement Learning

Getting Started

Prepare Python environment

Install the python environment as follows:

$ git clone https://github.com/mj-support/AndroidAgent.git
$ cd AndroidAgent
$ conda env create -f environment.yml
$ conda activate AndroidAgent

Install Android packages

Download and install Android Studio as it contains the necessary SDK, ADB and emulator tools. Add ADB and the Android emulator to $PATH to simplify the usage:

# for Linux + Bash
$ echo 'export PATH=$PATH:~/Android/Sdk/platform-tools' >> ~/.bashrc
$ echo 'export PATH=$PATH:~/Android/Sdk/emulator' >> ~/.bashrc
$ source ~/.bashrc

# for Mac + Zsh
$ echo 'export PATH=$PATH:~/Library/Android/Sdk/platform-tools' >> ~/.zshrc
$ echo 'export PATH=$PATH:~/Library/Android/Sdk/emulator' >> ~/.zshrc
$ source ~/.zshrc

Setup Emulator

To use models/airplane.zip, please follow the next steps. You can also configure your own Android Virtual Device (AVD) with your own settings instead. In this case you might have to start a new training run to let the agent adapt to a the new evironment. You can see the configured AVDs with $ emulator -list-avds.

  1. To configure your own Android Virtual Device (AVD) you need to open Android Studio.
  2. Click on 'More Actions' in the 'Welcome to Android Studio'-welcome menu and select 'Virtual Device Manager'.
  3. Create a new virtual device by clicking on the '+'
  4. Select 'Pixel 2' as hardware, 'VanillaIceCream' as system image and use 'my_avd' as AVD name and click 'Finish'

Launch emulator

$ emulator -avd my_avd -no-boot-anim -netdelay none -no-snapshot -wipe-data -verbose -no-audio -gpu swiftshader_indirect -no-snapshot -read-only -partition-size 512 &

# for headless mode
$ emulator -avd my_avd -no-window -no-boot-anim -netdelay none -no-snapshot -wipe-data -verbose -no-audio -gpu swiftshader_indirect -no-snapshot -read-only -partition-size 512 &

# check your emulator-ID or look different for usable emulators 
$ adb devices

Train the agent

You can start the training with the following command

$ python3 main.py

The resulting model will be saved in the models/ directory. So far, only the airplane task has been implemented, but the code is designed to allow smooth expansion for a wide range of tasks.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages