1. 準備工做android
1.1 安裝gcc 7.x版本ios
sudo apt-get install gcc-7 -ygit
1.2 安裝依賴的庫及其工具github
sudo apt install build-essential cmake cmake-data debhelper dbus google-mock \ libboost-dev libboost-filesystem-dev libboost-log-dev libboost-iostreams-dev \ libboost-program-options-dev libboost-system-dev libboost-test-dev \ libboost-thread-dev libcap-dev libsystemd-dev libegl1-mesa-dev \ libgles2-mesa-dev libglm-dev libgtest-dev liblxc1 \ libproperties-cpp-dev libprotobuf-dev libsdl2-dev libsdl2-image-dev lxc-dev \ pkg-config protobuf-compiler -y
1.3 安裝snapcraft打包工具swift
sudo apt-get install snapcraft -ybash
2. 獲取源碼工具
git clone https://github.com/anbox/anbox.git ~/anbox
fetch
cd ~/anboxui
3. 建立編譯目錄this
mkdir ~/anbox/build
cd ~/anbox/build
4. 生成Makefile
cmake ..
5. 編譯
make -j4
6. 打包成snap包
mkdir ~/anbox/android-images
wget -O ~/anbox/android-images/android.img https://build.anbox.io/android-images/2018/07/19/android_amd64.img
cd ~/anbox
snapcraft
錯誤處理:
6.1 Failed to fetch stage packages: Error downloading packages for part 'anbox': The
package 'libboost-program-options1.58.0' was not found..
直接修改~/anbox/snap/snapcraft.yaml文件中的軟件包名
stage-packages:
- libboost-log1.58.0 -> - libboost-log1.62.0
- libboost-iostreams1.58.0 -> - libboost-iostreams1.62.0
- libboost-program-options1.58.0 -> - libboost-program-options1.62.0
- libboost-thread1.58.0 -> - libboost-thread1.62.0
6.2 Cloning into '/home/jello/develop/source/github/anbox/parts/swiftshader/src'...
fatal: unable to access 'https://swiftshader.googlesource.com/SwiftShader/': Fai
led to connect to swiftshader.googlesource.com port 443: Connection timed out
Sorry, an error occurred in Snapcraft:
修改~/anbox/snap/snapcraft.yaml中的如下內容:
swiftshader:
plugin: cmake
source: https://swiftshader.googlesource.com/SwiftShader -> https://github.com/google/swiftshader.git
6.3 The linker version '2.23' used by the base 'core' is incompatible with files in this snap:
sudo snap install lxd
sudo lxd init
sudo snapcraft cleanbuild
7. 安裝生成的snap包
snap install --dangerous --devmode ~/anbox/*.snap