简体   繁体   English

Debian 10 - 使用 AVD 管理器运行 android 仿真器

[英]Debian 10 - Run android emulator with AVD Manager

My dockerfile is here:我的 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" 

OS version: PRETTY_NAME="Debian GNU/Linux 10 (buster)" .操作系统版本: PRETTY_NAME="Debian GNU/Linux 10 (buster)" To create an android emulator, I run below commands.要创建 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

Set LD_LIBRARY_PATH:设置 LD_LIBRARY_PATH:

export LD_LIBRARY_PATH=${ANDROID_HOME}/tools/lib64:${ANDROID_HOME}/emulator/lib64:${ANDROID_HOME}/emulator/lib64/qt/lib

I get an error when I start the emulator启动模拟器时出现错误

$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" &

emulator: ERROR: x86 emulation currently requires hardware acceleration.模拟器:错误:x86 仿真当前需要硬件加速。 Please ensure KVM is properly installed and usable: CPU acceleration status: /dev/kvm is not found: VT disabled in BIOS or KVM kernel module not loaded More info on configuring VM acceleration on Linux: https://developer.android.com/studio/run/emulator-acceleration#vm-linux General information on acceleration: https://developer.android.com/studio/run/emulator-acceleration .请确保 KVM 已正确安装且可用: CPU 加速状态:/dev/kvm 未找到: BIOS 中禁用 VT 或 KVM kernel 模块未加载 有关在 Linux 上配置 VM 加速的更多信息: https://developer.ZC31B30364CE193D2Z模块studio/run/emulator-acceleration#vm-linux关于加速的一般信息: https://developer.android.com/studio/run/emulator-acceleration

To solve this error, I run below command: echo "yes" | apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils ia32-libs-multiarch为了解决这个错误,我运行下面的命令: echo "yes" | apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils ia32-libs-multiarch echo "yes" | apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils ia32-libs-multiarch

Reading package lists... Building dependency tree... Reading state information... Package libvirt-bin is not available, but is referred to by another package. Reading package lists... Building dependency tree... Reading state information... Package libvirt-bin is not available, but is referred to by another package. This may mean that the package is missing, has been obsoleted, or is only available from another source E: Package 'libvirt-bin' has no installation candidate E: Unable to locate package ubuntu-vm-builder E: Unable to locate package ia32-libs-multiarch This may mean that the package is missing, has been obsoleted, or is only available from another source E: Package 'libvirt-bin' has no installation candidate E: Unable to locate package ubuntu-vm-builder E: Unable to locate package ia32 -libs-multiarch

I have tried many commands and possible solutions, but none of them doesn't work for me.我尝试了许多命令和可能的解决方案,但没有一个对我不起作用。 How can I run the emulator without android studio on debian 10?如何在 debian 10 上运行没有 android studio 的模拟器?

Try the -no-accel flag when you start the emulator, maybe this will help.启动模拟器时尝试-no-accel标志,也许这会有所帮助。

https://developer.android.com/studio/run/emulator-commandline https://developer.android.com/studio/run/emulator-commandline

Disable emulator VM acceleration when using an x86 or x86_64 system image.使用 x86 或 x86_64 系统映像时禁用仿真器 VM 加速。 It's useful for debugging only and is the same as specifying -accel off.它仅对调试有用,与指定 -accel off 相同。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM