我的 dockerfile 在这里:
FROM openjdk:8
RUN apt-get update && \
apt-get install -y wget unzip && \
rm -rf /var/lib/apt/lists/*
ENV ANDROID_HOME /android-sdk-linux
ENV PATH=${PATH}:${ANDROID_HOME}/tools:${ANDROID_HOME}/tools/bin:${ANDROID_HOME}/platform-tools
RUN wget -q https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip -O android-sdk-tools.zip \
&& unzip -q android-sdk-tools.zip -d ${ANDROID_HOME} \
&& rm android-sdk-tools.zip
RUN yes | sdkmanager --licenses
RUN touch /root/.android/repositories.cfg
RUN sdkmanager "tools" "platform-tools"
# 0 (Stable), 1 (Beta), 2 (Dev), and 3 (Canary)
RUN yes | sdkmanager --update --channel=3
RUN sdkmanager \
"system-images;android-29;google_apis;x86" \
"system-images;android-28;google_apis;x86" \
"system-images;android-26;google_apis;x86" \
"system-images;android-25;google_apis;armeabi-v7a" \
"system-images;android-24;default;armeabi-v7a" \
"system-images;android-22;default;armeabi-v7a" \
"system-images;android-19;default;armeabi-v7a" \
"extras;android;m2repository" \
"extras;google;m2repository" \
"extras;google;google_play_services" \
"extras;m2repository;com;android;support;constraint;constraint-layout;1.0.2" \
"extras;m2repository;com;android;support;constraint;constraint-layout;1.0.1" \
"add-ons;addon-google_apis-google-23" \
"add-ons;addon-google_apis-google-22" \
"add-ons;addon-google_apis-google-21"
操作系统版本:PRETTY_NAME="Debian GNU/Linux 10 (buster)"
. 要创建一个 android 模拟器,我运行以下命令。
$sdkmanager "emulator"
$echo "yes" | sdkmanager --licenses
$sdkmanager "--verbose" "--channel=0" "emulator"
$emulator -list-avds
$sdkmanager --install "system-images;android-29;default;x86"
$echo "no" | avdmanager --verbose create avd --force --name "my_local_emulator" --package "system-images;android-29;default;x86" --tag "default" --abi "x86"
$emulator -list-avds
my_local_emulator
设置 LD_LIBRARY_PATH:
export LD_LIBRARY_PATH=${ANDROID_HOME}/tools/lib64:${ANDROID_HOME}/emulator/lib64:${ANDROID_HOME}/emulator/lib64/qt/lib
启动模拟器时出现错误
$ANDROID_HOME/emulator/emulator @my_local_emulator "-no-audio" "-no-window" "-no-boot-anim" "-netdelay" "none" "-no-snapshot" "-wipe-data" "-gpu" "swiftshader_indirect" "-camera-back" "none" "-camera-front" "none" &
仿真器:错误:x86 仿真当前需要硬件加速!请确保 KVM 已正确安装且可用。CPU 加速状态:未找到 /dev/kvm:在 BIOS 中禁用 VT 或未加载 KVM 内核模块有关在 Linux 上配置 VM 加速的更多信息: https ://developer.android.com/studio/run/emulator-acceleration#vm -linux 关于加速的一般信息: https ://developer.android.com/studio/run/emulator-acceleration 。
为了解决这个错误,我运行以下命令:
echo "yes" | apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils ia32-libs-multiarch
读取包列表...构建依赖树...读取状态信息...包 libvirt-bin 不可用,但被另一个包引用。这可能意味着该软件包丢失、已过时或仅可从其他来源获得 E:软件包“libvirt-bin”没有安装候选 E:无法找到软件包 ubuntu-vm-builder E:无法找到软件包 ia32 -libs-multiarch
我尝试了许多命令和可能的解决方案,但没有一个对我不起作用。如何在 debian 10 上运行没有 android studio 的模拟器?