使用 docker 安装 AndroidNativeEmu 及打包上传

摘取 docker python:3.7 环境

docker pull python:3.7
# run python 3.7
docker run -it 879165535a54 bash

安装依赖

进入 docker 后,安装 AndroidNativeEmu

git clone https://github.com/AeonLucid/AndroidNativeEmu.git
cd AndroidNativeEmu
pip install -r requirements.txt
# test example
cp samples/example.py ./
cp -r samples/example_binaries ./
python3 example.py

问题解决

如果上面安装运行时遇到以下问题

Traceback (most recent call last):
  File "example.py", line 7, in <module>
    from androidemu.emulator import Emulator
  File "/root/AndroidNativeEmu/androidemu/emulator.py", line 15, in <module>
    from androidemu.hooker import Hooker
  File "/root/AndroidNativeEmu/androidemu/hooker.py", line 1, in <module>
    from keystone import Ks, KS_ARCH_ARM, KS_MODE_THUMB
  File "/usr/local/lib/python3.7/site-packages/keystone/__init__.py", line 4, in <module>
    from .keystone import Ks, ks_version, ks_arch_supported, version_bind, debug, KsError, __version__
  File "/usr/local/lib/python3.7/site-packages/keystone/keystone.py", line 74, in <module>
    raise ImportError("ERROR: fail to load the dynamic library.")
ImportError: ERROR: fail to load the dynamic library.

需要自己构建 keystone, 官方文档参考

apt-get update -y
apt-get install cmake
mkdir build
cd build
../make-share.sh
make install
ldconfig
kstool x32 "add eax, ebx"

commit

docker commit 7c3bb3182ddb <username>/<dockerlibname>:1.2

push 到 docker 仓库

docker push <username>/<dockerlibname>:1.2

如果没有登录 docker 先登录

发表评论