
Waydroid 介绍
- Waydroid 是一种基于容器的、能在常规的 GNU/Linux 系统上启动完整 Android 系统的方法。
- Waydroid 不支持 NVIDIA 显卡(tegra 除外),需要运行在 Wayland 显示服务器下。
- Waydroid 基于 LineageOS。
安装环境
操作系统: Fedora 38 硬件配置: Intel ALder Lake I5-12500H 桌面环境: Gnome 44 Wayland 内核版本: 6.2.15-300.fc38.x86_64
安装
Gnome 44 默认显示服务是 Wayland,如需切换注销选择显示服务登录。
命令行安装:
sudo dnf install waydroid
sudo systemctl enable --now waydroid-container
安装完成之后打开 waydroid 程序,在 OTA 文本框填入以下链接:
System OTA
: https://ota.waydro.id/system
Vendor OTA
: https://ota.waydro.id/vendor
然后选择是否需要安装 OPENGAPPS ,点击下载按钮,等待镜像下载完成。 镜像下载完成之后会自动安装,镜像初始化完成后好像 waydroid 会自动启动(这里我忘记了。。。)
Waydroid 命令与使用
启动容器
sudo waydroid container start
开启 Waydroid
waydroid session start
全屏模式
waydroid show-full-ui
多窗口模式
# 开启waydroid prop set persist.waydroid.multi_windows true# 关闭waydroid prop set persist.waydroid.multi_windows false
sudo systemctl restart waydroid-container
设置宽高度
waydroid prop set persist.waydroid.width 0-9999 (int) Used for user to override desired resolutionwaydroid prop set persist.waydroid.height 0-9999 (int) Used for user to override desired resolution
Other Waydroid Prop Options
waydroid prop set persist.waydroid.cursor_on_subsurface true/false (bool) Workaround for showing the cursor in multi_windows mode on some compositorswaydroid prop set persist.waydroid.invert_colors true/false (bool) Swaps the color space from RGBA to BGRA (only works with our patched mutter so far)waydroid prop set persist.waydroid.height_padding 0-9999 (int) Adjust height paddingwaydroid prop set persist.waydroid.width_padding 0-9999 (int) Adjust width paddingwaydroid prop set persist.waydroid.suspend true/false (bool, default: true on kernel 4.9 and later) Let the Waydroid container sleep (after the display timeout) when no apps are activewaydroid prop set persist.waydroid.uevent true/false (bool, default: false) Allow android direct access to hotplugged devicesModify app behaviourwaydroid prop set persist.waydroid.fake_touch (string, 91 character limit) Comma separated list of package names for which mouse inputs should be interpreted as touch inputs instead. Supports wildcards with *. For example, set this to "com.rovio.*" to match all games by Rovio.waydroid prop set persist.waydroid.fake_wifi (string, 91 character limit) Comma separated list of package names for which the system will always appear as if connected to wifi. Supports wildcards with *. For example, set this to "com.gameloft.*" to match all games by Gameloft.
安装应用
waydroid app install xxx.apk
#orusage: waydroid app [-h] {install,remove,launch,intent,list} ...
options: -h, --help show this help message and exit
subaction: {install,remove,launch,intent,list} install push a single package to the container and install it remove remove single app package from the container launch start single application intent start single application list list installed applications
安装自定义镜像
将下载好的镜像放入目录:/usr/share/waydroid-extra/images/
,然后运行:
waydroid init -f
使用 adb 连接调试
使用命令:
waydroid status
显示如下:
Session: RUNNINGContainer: RUNNINGVendor type: MAINLINEIP address: 192.168.240.112Session user: encorexin(1000)Wayland display: wayland-0
然后使用命令链接:
abd connect <ip>:5555
设置共享目录
sudo mount --bind ~/Documents ~/.local/share/waydroid/data/media/0/Documents sudo mount --bind ~/Downloads ~/.local/share/waydroid/data/media/0/Download sudo mount --bind ~/Music ~/.local/share/waydroid/data/media/0/Music sudo mount --bind ~/Pictures ~/.local/share/waydroid/data/media/0/Pictures sudo mount --bind ~/Videos ~/.local/share/waydroid/data/media/0/Movies
使用脚本安装 Waydroid
项目主页:https://github.com/ayasa520/waydroid_script
安装脚本
sudo dnf install lzip
git clone https://github.com/ayasa520/waydroid_script.git
cd waydroid_script
sudo python3 -m pip install -r requirements.txt
使用
sudo python3 main.py
选择需要安装的 Android 版本
选择需要操作
选择需要安装的应用
如果之前已经安装过 waydroid 了只需要安装后面的应用就行。
获取设备 id 并注册给谷歌
使用命令进入 android shell:
sudo waydroid shellANDROID_RUNTIME_ROOT=/apex/com.android.runtime ANDROID_DATA=/data ANDROID_TZDATA_ROOT=/apex/com.android.tzdata ANDROID_I18N_ROOT=/apex/com.android.i18n sqlite3 /data/data/com.google.android.gsf/databases/gservices.db "select * from main where name = \"android_id\";"
然后会返回一段数据:android_id|*
星号为设备 id,是一串数字。
进入网址:https://www.google.com/android/uncertified,登录 Google 账号,将设备 id 复制到文本框内,点击注册等待半个小时然后重启 waydroid 就能在 waydroid 里面登录 Google Play 了。(需要将 waydroid 设备连接一次网络才能获取到设备 id,否则返回的内容为空。)
使用脚本获取:
sudo python3 main.py certified
至此,安装完成。
删除 Waydroid
sudo dnf remove waydroid
sudo rm -rf /usr/bin/waydroid /var/lib/waydroid /home/.waydroid ~/waydroid ~/.share/waydroid ~/.local/share/applications/*aydroid* ~/.local/share/waydroid
评论
评论系统加载失败
无法连接到评论服务,请检查网络连接或稍后再试。