1.验证KVM可用性(X86机器)
grep -c -w "vmx\|svm" /proc/cpuinfo
如果返回非0值,则说明kvm已经配置好。
2.安装Cuttlefish模拟器
sudo apt install git devscripts config-package-dev debhelper-compat golang curlgit clone https://github.com/google/android-cuttlefishcd android-cuttlefishfor dir in base frontend; docd $dirdebuild -i -us -uc -b -dcd ..donesudo dpkg -i ./cuttlefish-base_*_*64.deb || sudo apt-get install -fsudo dpkg -i ./cuttlefish-user_*_*64.deb || sudo apt-get install -fsudo usermod -aG kvm,cvdnetwork,render $USERsudo reboot
-
这里面有go语言环境的坑,修改以下配置
-
vim android-cuttlefish/frontend/src/goutil# 将下面这一行注释掉,添加后面的两行 # export GOPROXY="proxy.golang.org|proxy.golang.org|direct" export GO111MODULE=on export GOPROXY=https://goproxy.io
3.编译Android镜像
-
source build/envsetup.shlunch aosp_cf_x86_64_phone-userdebugm
4.Cuttlefish模拟器加载镜像开机
-
launch_cvd --start_webrtc=true
-
WebRTC流式传输显示画面优点。
-
1.无需在客户端计算机中安装任何其他软件。
2.比VNC 更高效的编码
3.浏览器使用adb
4.可扩展协议(摄像头、麦克风、传感器数据都可以通过WebRTC实现)
5.在浏览器中查看
https://localhost:8443
6.Cuttlefish多屏显示
cvd start \--display=width=1080,height=600 \--display=width=400,height=600,dpi=120 \--display=width=800,height=600,refresh_rate_hz=30adb shell am start-activity -n com.android.dialer/.main.impl.MainActivity --display 1
7.Cuttlefish启动多个模拟设备
launch_cvd --start_webrtc=true --num_instances= 2