gpt4 book ai didi

Android 模拟器 (AVD) 无法在 MacOS 中启动

转载 作者:IT老高 更新时间:2023-10-28 23:36:19 33 4
gpt4 key购买 nike

当目标平台为 Level 26 (Android 8.0.0) 或更高版本时,我的 android 模拟器无法启动。模拟器只显示黑屏,而模拟器进程持续运行大约。 100% 中央处理器。请注意,25 级及以下的工作正常。

这是我目前发现的:

我从命令行启动了模拟器,以便检查 logcat:

./emulator -avd Test2 -logcat '*:e'

以下是 logcat 的摘录:

[    0.000000] Initializing cgroup subsys cpu
[ 0.000000] Initializing cgroup subsys cpuacct
[ 0.000000] Linux version 3.18.91+ (android-build@wphr1.hot.corp.google.com) (gcc version 4.9 20140827 (prerelease) (GCC) ) #1 SMP PREEMPT Tue Jan 9 20:30:51 UTC 2018
[ 0.000000] Command line: qemu=1 androidboot.hardware=ranchu clocksource=pit androidboot.console=ttyS0 android.qemud=1 console=0 console=0 android.checkjni=1 qemu.gles=1 androidboot.logcat=*:e androidboot.selinux=permissive ndns=2 ndns=2
[ 0.000000] Disabled fast string operations
...
(skipping a few hundred lines)
...
[ 1.443608] init: init first stage started!
[ 1.443608] init: Using Android DT directory /proc/device-tree/firmware/android/
[ 1.443608] init: First stage mount skipped (missing/incompatible fstab in device tree)
[ 1.453842] init: Skipped setting INIT_AVB_VERSION (not in recovery mode)
[ 1.453842] init: Loading SELinux policy
[ 1.453842] selinux: SELinux: Could not open /sepolicy: No such file or directory
[ 1.453842]
[ 1.463161] init: Failed to load monolithic SELinux policy: No such file or directory
[ 1.463161] init: panic: rebooting to bootloader
[ 1.463161] init: Reboot start, reason: reboot, rebootTarget: bootloader
[ 1.472277] init: android::WriteStringToFile open failed: No such file or directory
[ 1.472277] init: Shutdown timeout: 6
[ 1.472277] init: terminating init services
[ 1.472277] init: waitpid failed: No child processes
[ 1.482231] init: Terminating running services took 0.013438 seconds with remaining services:0
[ 1.482231] init: waitpid failed: No child processes
[ 1.482231] init: vold not running, skipping vold shutdown
[ 1.607664] init: powerctl_shutdown_time_ms:128:0
[ 1.607664] init: Reboot ending, jumping to kernel
[ 1.607664] reboot: Restarting system with command 'bootloader'
[ 1.607664] reboot: machine restart
[ 0.000000] Initializing cgroup subsys cpu
[ 0.000000] Initializing cgroup subsys cpuacct
[ 0.000000] Linux version 3.18.91+ (android-build@wphr1.hot.corp.google.com) (gcc version 4.9 20140827 (prerelease) (GCC) ) #1 SMP PREEMPT Tue Jan 9 20:30:51 UTC 2018
[ 0.000000] Command line: qemu=1 androidboot.hardware=ranchu clocksource=pit androidboot.console=ttyS0 android.qemud=1 console=0 console=0 android.checkjni=1 qemu.gles=1 androidboot.logcat=*:e androidboot.selinux=permissive ndns=2 ndns=2
[ 0.000000] Disabled fast string operations
...

这会每 5 秒无限重复。所以我怀疑我的问题与 SELinux 有关。这是有道理的,因为 Android 8 在该领域引入了许多变化:https://source.android.com/security/selinux/

但我不知道为什么其他人没有这个问题,也不知道该怎么办。

最佳答案

我发现这是主机上的 SELinux 问题。这是解决它的一种方法:

sudo setsebool -P selinuxuser_execheap 1

还有更具体的方法。但是,您需要捕获异常以获取确切的命令:

现在通过执行允许此访问:

ausearch -c 'qemu-system-x86' --raw | audit2allow -M my-qemusystemx86
semodule -X 300 -i my-qemusystemx86.pp

当然,您可以通过使 SELinux 在您的主机上临时允许进行一般测试。

在我这样做之后,手机显示屏不再是黑色的。

关于Android 模拟器 (AVD) 无法在 MacOS 中启动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52131442/

33 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com