加载共享库时的错误:libpulse.so.0:无法打开共享对象文件:没有此类文件或目录

发布于 2025-01-23 04:07:41 字数 1911 浏览 2 评论 0 原文

我正在尝试在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/opt/android-sdk/emulator/qemu/linux-x86_64/qemu-system-x86_64:加载共享库时错误:libpulse.so.0:无法打开共享对象文件:没有这样的文件或目录>

目录启动的模拟器:

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映像正在运行 openjdk:11.0.13-slim and 已安装工具。

我想念什么?为什么模拟器不正确启动?

I am trying to run an Android emulator in a Docker container.

/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 &

But I get this error:

/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

I then attempt to wait for the emulator to start:

while [ "`adb shell getprop sys.boot_completed | tr -d '\r' `" != "1" ] ; do sleep 1; done

But adb can't find the device:

adb: no devices/emulators found

Before running the emulator, I set it up with the following commands.

# 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

The Docker image is running openjdk:11.0.13-slim and has Android command line tools installed.

What am I missing? Why isn't the emulator starting correctly?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

水水月牙 2025-01-30 04:07:41

看来您试图用 -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 标志将减少运行模拟器所需的依赖次数。

在模拟器上禁用图形窗口显示。当在没有显示的服务器上运行模拟器时,此选项很有用。您仍然可以通过ADB或控制台访问模拟器。

It appears that you were trying to run the emulator with the -no-window flag but you used it incorrectly.

Replace $no_window with -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 &

The -no-window flag will reduce the number of dependencies needed to run the emulator.

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文