Background
- Android VTS
The Android Vendor Test Suite (VTS) provides extensive new functionality for Android testing and promotes a test-driven development process. - Android R emulator
Run the latest Android R image from Google CI build artifacts - WSL
WSL is a collection of components that enables native Linux ELF64 binaries to run on Windows. It contains both user mode and kernel mode components. It is primarily comprised of:- User mode session manager service that handles the Linux instance life cycle
- Pico provider drivers (lxss.sys, lxcore.sys) that emulate a Linux kernel by translating Linux syscalls
- Pico processes that host the unmodified user mode Linux (e.g. /bin/bash)
Environmental Requirements
- Windows 10 64bit computer with Windows build 16215 or later
- Enable "Windows Subsystem for Linux" optional feature on Windows: check here
- Android SDK with "emulator", "extras;intel;Hardware_Accelerated_Execution_Manager", "platform-tools", "tools" packages installed
- Enable Intel(R) Virtualization Technology (VT) and install Intel HAXM
Quick Start
- Download android-R.zip and unzip in %SDK_ROOT%\system-images\
- Download Pixel_API_30.zip and unzip in %UserProfile%\.android\avd\
- Start Android emulator: %SDK_ROOT%\emulator\emulator.exe -avd Pixel_API_30
- Check "emulator-5554" in the list of "adb devices"
- Create a symlink to let adb.exe can be found in WSL by "adb"
cd /D %SDK_ROOT%\platform-tools
mklink adb adb.exe - Download and install Ubuntu 18.04 Aapx through powershell:
Add-AppxPackage CanonicalGroupLimited.Ubuntu18.04onWindows_1804.2018.817.0_x64__79rhkp1fndgsc.Appx - Download and import my WSL distro backup(eric/1688) through Command Prompt
wsl --import Ubuntu-18.04 %LOCALAPPDATA%\Packages\CanonicalGroupLimited.Ubuntu18.04onWindows_79rhkp1fndgsc\LocalState eric-wsl-backup.tar - Run the imported WSL distro from Command Prompt
wsl --distribution Ubuntu-18.04 - In WSL, modify PATH in ~/.bashrc to your Windows adb path
# for Windows adb.exe
export PATH=/mnt/c/your/path/to/android_sdk/platform-tools:$PATH - In WSL, run the vts-tradefed
cd ~/android-vts/tools
./vts-tradefed
run vts-codelab -m VtsCodelabHelloWorldTest - Open the test_result.html report in %LOCALAPPDATA%\CanonicalGroupLimited.Ubuntu18.04onWindows_79rhkp1fndgsc\LocalState\rootfs\home\eric\android-vts\results\2019.12.15_03.59.09
PS. Do NOT edit/modify files from Windows, only WSL can manipulate files inside lxfs
Start from scratch
- Prepare Android R system image
- Download android-sdk_XXXXXXX_linux-x86.zip from Google Android aosp-master grid
For example:
click sdk_x86_64-sdk Artifacts link in submit 6073524 and download android-sdk_6073524_linux-x86.zip - Unzip android-sdk_XXXXXXX_linux-x86.zip and get system-images\android-R
- Download android-sdk_XXXXXXX_linux-x86.zip from Google Android aosp-master grid
- Prepare Pixel_API_30 AVD
create an API_29 AVD then duplicate it and modify the following- Pixel_API_30.ini
replace Pixel_API_29 to Pixel_API_30
replace target=android-29 to target=android-R
- Pixel_API_30.avd\config.ini
remove all lines contain "PlayStore"
replace all 29 to 30
set image.sysdir.1=system-images\android-R\x86_64\
- Pixel_API_30.ini
- Install WSL Terminal
- Search and install "Ubuntu 18.04 LTS" by Microsoft Store
- Add-AppxPackage XXX.aapx
- Use MobaXterm as WSL Terminal
- Setup Ubuntu distro
sudo sed -i 's/us.archive.ubuntu.com/free.nchc.org.tw/g' /etc/apt/sources.list
sudo sed -i 's/archive.ubuntu.com/free.nchc.org.tw/g' /etc/apt/sources.list
sudo sed -i 's/security.ubuntu.com/free.nchc.org.tw/g' /etc/apt/sources.list
sudo apt-get clean all
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install python-dev \
python-protobuf protobuf-compiler \
python-virtualenv python-pip \
default-jdk \
unzip - Mount Windows filesystem
sudo mkdir /mnt/d
sudo mount -t drvfs D: /mnt/d
Reference
- Android VTS
https://source.android.com/compatibility/vts
https://source.android.com/compatibility/vts/systems
https://packages.ubuntu.com/bionic/android-sdk-platform-tools
https://packages.ubuntu.com/zh-tw/bionic/default-jdk (openjdk-11-jdk)
https://developer.android.com/studio#downloads
- Google Android CI
https://ci.android.com/ - Windows Subsystem for Linux
https://docs.microsoft.com/zh-tw/windows/wsl/about
https://docs.microsoft.com/zh-tw/windows/wsl/install-win10
https://docs.microsoft.com/en-us/powershell/module/dism/enable-windowsoptionalfeature?view=win10-ps
https://docs.microsoft.com/en-us/windows/wsl/release-notes
https://en.wikipedia.org/wiki/Windows_Subsystem_for_Linux#WSL_2 - WSL Ubuntu distros
https://docs.microsoft.com/zh-tw/windows/wsl/install-manual
https://docs.microsoft.com/zh-tw/windows/wsl/initialize-distro
https://wiki.ubuntu.com/WSL
https://winaero.com/blog/export-import-wsl-linux-distro-windows-10/
http://defrances.co/post/adbwsl/ - WSL filesystem
https://www.howtogeek.com/331053/how-to-mount-removable-drives-and-network-locations-in-the-windows-subsystem-for-linux/
https://blogs.msdn.microsoft.com/wsl/2016/06/15/wsl-file-system-support/ - LXSS
https://github.com/ionescu007/lxss - WSL vs WSL2
WSL$ uname -a
Linux YOUR_HOSTNAME 4.4.0-18362-Microsoft #476-Microsoft Fri Nov 01 16:53:00 PST 2019 x86_64 x86_64 x86_64 GNU/Linux
WSL2$ uname -a
Linux YOUR_HOSTNAME 4.19.84-microsoft-standard #1 SMP Wed Nov 13 11:44:37 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux - Windows Insider
https://docs.microsoft.com/en-US/windows-insider/flight-hub/
https://blogs.windows.com/windowsexperience/tag/windows-insider-program/
留言
張貼留言