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 curl
git clone https://github.com/google/android-cuttlefish
cd android-cuttlefish
for dir in base frontend; do
cd $dir
debuild -i -us -uc -b -d
cd ..
done
sudo dpkg -i ./cuttlefish-base_*_*64.deb || sudo apt-get install -f
sudo dpkg -i ./cuttlefish-user_*_*64.deb || sudo apt-get install -f
sudo usermod -aG kvm,cvdnetwork,render $USER
sudo 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.sh lunch aosp_cf_x86_64_phone-userdebug m
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=30
adb shell am start-activity -n com.android.dialer/.main.impl.MainActivity --display 1
7.Cuttlefish启动多个模拟设备
launch_cvd --start_webrtc=true --num_instances= 2