Setup Information App Setup Running an App on Pepper - rosielab/pepper-documentation GitHub Wiki
Pepper Android Emulator Setup
This is a set up guide for configuring your desktop environment to run the Android Studio Pepper emulator. Following the original installation tutorial will result in the Pepper emulator crashing.
If you are on Ubuntu 22.04, skip step 1 and go straight to application installation.
Prerequisites
- Your CPU MUST have the capability to run nested virtualization. Some known issues with this include devices running MacOS with an Intel chip. Check according to your operating system.
- A minimum of 50GB of storage space allocated to your VM or your computer if you are on Ubuntu.
Overview
- Set up Ubuntu 22.04 VM (Skip if you are on Ubuntu 22.04)
- Set up Android Studio and Desktop Environment
- Create Project
- Run Emulator
1. Set up an Ubuntu 22.04 VM
Windows Hyper-V Set up
Follow this tutorial to create your VM using Hyper-V Make sure you are installing Ubuntu 22.04.
Other OS VirtualBox Set up
Follow this tutorial to create your VM using VirtualBox Make sure you are installing Ubuntu 22.04.
2. Set up Android Studio and Desktop Environment
Download Android Studio
- From the developer archive, download Android Studio Bumblebee | 2021.1.1 Patch 3 April 7, 2022 https://developer.android.com/studio/archive
- Unzip it into Downloads (or wherever you want it to run)
- Go into the Downloads folder in your terminal and run Android studio using the commands.
cd android-studio/bin
./studio.sh
- Install Android studio using the prompts according to default installation settings.
Install Java 1.8
- Install Java 1.8 and make sure your system is using Java 1.8.
sudo apt-get install openjdk-8-jdk
java -version
Configure Android Studio Environment for 29.0.3
From Android Studio:
-
Choose Configure > SDK Manager, or Choose Tools > SDK Manager. The SDK Manager appears.
-
Checkmark 'Show Package Details'.
-
Select Android API 29 on "SDK Platforms" and click "Apply". The installation should begin.
-
Next to the "SDK Platforms: Tab, there is the "SDK Tools" Tab. Select the tab, checkmark "Show Package Details" and select version 29.0.3. Click the apply button and the installation should begin again.
Get Pepper SDK Plugin and Tools
- From Android Studio choose File > Settings, select the Plugins sub-menu.
- Enter "Pepper" in the search bar. Select "Pepper SDK" and install it.
- After installation, choose Tools > Pepper SDK > Robot SDK Manager.
- Select "API 7" and all of the corresponding tools. Click "Apply" and wait until the installation is finished.
Emulator setup
These instructions are adapted from: https://support.unitedrobotics.group/en/support/discussions/topics/80000657899
- Install KVM
sudo apt install qemu-kvm
- Add yourself to the kvm group
sudo adduser yourusername kvm
- Relink the correct libraries
-> 1. Navigate to the API lib folder
cd /home/$USER/.local/share/Softbank Robotics/RobotSDK/API 7/tools/lib
-> 2. Back up the old library
mv libz.so.1 libz.so.1.bak
-> 3. Relink the System one
ln -s /usr/lib/x86_64-linux-gnu/libz.so libz.so.1
- Restart Android Studio
- Make sure you can run virtualization by running the following command:
egrep -c '(vmx|svm)' /proc/cpuinfo
- Make sure kvm acceleration is enabled as well:
sudo kvm-ok
If both these prerequisites are not met, Android Studio will crash if you attempt to run the emulator.
3. Create Project
-
From Android Studio, choose: File > New > New Project and configure your project. Minimum API level should be API 23: Android 6.0 (Marshmallow).
-
Configure your project by navigating to File > Project Structure… > Module and make sure Source Compatibility and Target Compatibility are set to 1.8 (Java 8). Also make sure the Compile SDK is 29 and Build Tools version is 29.0.3.
-
Modify the Gradle JDK to also be 1.8 by going to the same Project Structure window -> SDK Location -> Gradle Settings.
-
Restart Android Studio and open your project. Choose File -> New -> Robot Application to robotify your current project.
-
Depending on your language (Kotlin or Java) copy the code snippet from step 4 into your MainActivity class.
-
You will get errors on the QI SDK libraries that are not imported. Resolve the import errors by hovering over the code and clicking "Resolve".
4. Run Emulator
- Choose Tools > Pepper SDK > Emulator
-> You may get this error: File Not found "/home/user/Downloads/android-studio/jre/emulator/qemu/linux-x86_64/qemu-system-i386"
Run this to find the directory location:
For example, mine was in ./Android/Sdk/emulator/qemu. Copy the entire "qemu" folder and place it into wherever your emulator path is. Mine was "/home/user/Downloads/android-studio/jre/emulator" Restart Android Studio and try running the emulator again.find qemu
5. Run Project
Once your emulator is running, make sure that: the selected run configuration of your project is app and that the selected device is unknown AOSP on IA Emulator. Click the "Run" button.