加载共享库时出错:libpulse.so.0:无法打开共享对象文件:没有这样的文件或目录
error while loading shared libraries: libpulse.so.0: cannot open shared object file: No such file or directory
我正尝试在 Docker 容器中 运行 一个 Android 模拟器。
/opt/android-sdk/emulator/emulator -avd "Android_API_29" -noaudio -no-boot-anim -netdelay none -accel on $no_window -no-snapshot -memory 4096 -partition-size 4096 &
但是我得到这个错误:
/opt/android-sdk/emulator/qemu/linux-x86_64/qemu-system-x86_64: error while loading shared libraries: libpulse.so.0: cannot open shared object file: No such file or directory
然后我尝试等待模拟器启动:
while [ "`adb shell getprop sys.boot_completed | tr -d '\r' `" != "1" ] ; do sleep 1; done
但是adb
找不到设备:
adb: no devices/emulators found
在运行启用模拟器之前,我使用以下命令对其进行了设置。
# Download Android Platform Tools
sdkmanager --install "platform-tools" "platforms;android-29"
# Download Android System Image
sdkmanager --install "system-images;android-29;google_apis;x86"
# Create Emulator
echo "no" | avdmanager --verbose create avd --name "Android_API_29" --package "system-images;android-29;google_apis;x86" --force
# Configure Emulator Settings
echo "hw.lcd.width=1080" >> ~/.android/avd/Android_API_29.avd/config.ini
echo "hw.lcd.height=1920" >> ~/.android/avd/Android_API_29.avd/config.ini
echo "hw.lcd.density=440" >> ~/.android/avd/Android_API_29.avd/config.ini
echo "hw.initialOrientation=Portrait" >> ~/.android/avd/Android_API_29.avd/config.ini
echo "hw.keyboard=yes" >> ~/.android/avd/Android_API_29.avd/config.ini
echo "hw.mainKeys=yes" >> ~/.android/avd/Android_API_29.avd/config.ini
Docker 图像 运行ning openjdk:11.0.13-slim
并且安装了 Android command line 工具。
我错过了什么?为什么模拟器不能正常启动?
您似乎试图 运行 带有 -no-window
标志的模拟器,但您使用不正确。
将 $no_window
替换为 -no-window
。
# Before
/opt/android-sdk/emulator/emulator -avd "Android_API_29" -noaudio -no-boot-anim -netdelay none -accel on $no_window -no-snapshot -memory 4096 -partition-size 4096 &
# After
/opt/android-sdk/emulator/emulator -avd "Android_API_29" -noaudio -no-boot-anim -netdelay none -accel on -no-window -no-snapshot -memory 4096 -partition-size 4096 &
-no-window
标志将减少 运行 模拟器所需的依赖项数量。
Disable graphical window display on the emulator. This option is useful when running the emulator on servers that have no display. You'll still be able to access the emulator through adb or the console.
https://developer.android.com/studio/run/emulator-commandline#advanced
我正尝试在 Docker 容器中 运行 一个 Android 模拟器。
/opt/android-sdk/emulator/emulator -avd "Android_API_29" -noaudio -no-boot-anim -netdelay none -accel on $no_window -no-snapshot -memory 4096 -partition-size 4096 &
但是我得到这个错误:
/opt/android-sdk/emulator/qemu/linux-x86_64/qemu-system-x86_64: error while loading shared libraries: libpulse.so.0: cannot open shared object file: No such file or directory
然后我尝试等待模拟器启动:
while [ "`adb shell getprop sys.boot_completed | tr -d '\r' `" != "1" ] ; do sleep 1; done
但是adb
找不到设备:
adb: no devices/emulators found
在运行启用模拟器之前,我使用以下命令对其进行了设置。
# Download Android Platform Tools
sdkmanager --install "platform-tools" "platforms;android-29"
# Download Android System Image
sdkmanager --install "system-images;android-29;google_apis;x86"
# Create Emulator
echo "no" | avdmanager --verbose create avd --name "Android_API_29" --package "system-images;android-29;google_apis;x86" --force
# Configure Emulator Settings
echo "hw.lcd.width=1080" >> ~/.android/avd/Android_API_29.avd/config.ini
echo "hw.lcd.height=1920" >> ~/.android/avd/Android_API_29.avd/config.ini
echo "hw.lcd.density=440" >> ~/.android/avd/Android_API_29.avd/config.ini
echo "hw.initialOrientation=Portrait" >> ~/.android/avd/Android_API_29.avd/config.ini
echo "hw.keyboard=yes" >> ~/.android/avd/Android_API_29.avd/config.ini
echo "hw.mainKeys=yes" >> ~/.android/avd/Android_API_29.avd/config.ini
Docker 图像 运行ning openjdk:11.0.13-slim
并且安装了 Android command line 工具。
我错过了什么?为什么模拟器不能正常启动?
您似乎试图 运行 带有 -no-window
标志的模拟器,但您使用不正确。
将 $no_window
替换为 -no-window
。
# Before
/opt/android-sdk/emulator/emulator -avd "Android_API_29" -noaudio -no-boot-anim -netdelay none -accel on $no_window -no-snapshot -memory 4096 -partition-size 4096 &
# After
/opt/android-sdk/emulator/emulator -avd "Android_API_29" -noaudio -no-boot-anim -netdelay none -accel on -no-window -no-snapshot -memory 4096 -partition-size 4096 &
-no-window
标志将减少 运行 模拟器所需的依赖项数量。
Disable graphical window display on the emulator. This option is useful when running the emulator on servers that have no display. You'll still be able to access the emulator through adb or the console.
https://developer.android.com/studio/run/emulator-commandline#advanced