bash
环境:intel PC,Ubuntu20.04
目标:在Ubuntu20.04上搭建waydroid Android容器系统
1. 搭建weston环境
由于waydroid依赖wayland环境,当前Ubuntu20.04默认为X11,需要安装weston
bash
$sudo apt install weston
$weston
#进入Weston Composer - screen0界面,点击左上角黑色图标,可以弹出weston命令行
bash
#在weston命令行可运行weston测试程序
weston-simple-egl
2. 下载Waydroid Android镜像
-
- 下载Android system.img和vendor.img
https://link.zhihu.com/?target=https%3A//sourceforge.net/projects/waydroid/files/images/system/lineage/waydroid_x86_64/lineage-18.1-20230311-GAPPS-waydroid_x86_64-system.zip
https://link.zhihu.com/?target=https%3A//udomain.dl.sourceforge.net/project/waydroid/images/vendor/waydroid_x86_64/lineage-18.1-20230311-MAINLINE-waydroid_x86_64-vendor.zip
-
- 安装waydroid
bash
sudo apt install curl ca-certificates -y
curl https://repo.waydro.id | sudo bash
sudo apt install waydroid -y
-
- 安装镜像
bash
#将下载下来的镜像解压后得到 system.img,vendor.img
unzip lineage-18.1-20230311-GAPPS-waydroid_x86_64-system.zip
unzip lineage-18.1-20230311-MAINLINE-waydroid_x86_64-vendor.zip
sudo mkdir -p /usr/share/waydroid-extra/images
sudo cp system.img /usr/share/waydroid-extra/images
sudo cp vendor.img /usr/share/waydroid-extra/images
-
- waydroid初始化
bash
sudo waydroid init
-
- 重启waydroid container
bash
sudo systemctl restart waydroid-container.service
sudo systemctl status waydroid-container.service
-
- 启动weston和waydroid
bash
# 启动weston
$weston
# 进入Weston Composer - screen0界面,点击左上角黑色图标,可以弹出weston命令行
- 5.1 在weston窗口中执行
bash
sudo waydroid container start
sudo waydroid session start
bash
# 如果报错:waydroid container service is already running.在原生窗口执行
sudo systemctl stop waydroid-container.service
sudo systemctl status waydroid-container.service
# 在weston启动的视窗里面的terminal里再次执行前面的容器启动命令:
sudo waydroid container start
waydroid session start
# 显示出waydroid Android界面
- 5.2 全屏启动
bash
waydroid show-full-ui
- 5.3 自定义
bash
默认全屏模式,开启多窗口体验更好。也可以只修改窗口大小,模拟平板竖屏界面。
开启/关闭多窗口:
waydroid prop set persist.waydroid.multi_windows true/false
设置窗口大小:
waydroid prop set persist.waydroid.width 600
waydroid prop set persist.waydroid.height 800
重置为默认:
waydroid prop set persist.waydroid.width ""
waydroid prop set persist.waydroid.height ""
PS:Waydroid 打开状态修改,重新打开容器生效。
停止容器命令:waydroid session stop