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

问题描述 投票:16回答:4

当目标平台为Level 26(Android 8.0.0)或更高版本时,我的android模拟器无法启动。模拟器只显示黑屏,而模拟器进程持续运行大约。 100%CPU。请注意,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+ ([email protected]) (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+ ([email protected]) (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/

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

android avd selinux
4个回答
0
投票

您是否尝试过从AVD向导擦除模拟器的数据?

我遇到了同样的问题,并在发布之前通过擦除模拟器解决了问题。

enter image description here


0
投票

该问题很可能与GPU驱动程序有关。尝试安装正确的GPU驱动程序。

一些GPU很难找到。如果找不到,请使用如下所述的软件图形。

转到虚拟设备设置,然后在模拟性能部分下将Software作为图形。这可能会显着降低性能。但它会毫无问题地工作。

enter image description here


0
投票

在“仿真性能图形”选项中,在AVD设置中选择“软件”,而不是“自动”或“硬件”


0
投票

简单解决方案删除android文件夹。重新安装android sdk。删除用户文件夹中的avd设置。创造新的AVD。

© www.soinside.com 2019 - 2024. All rights reserved.