当目标平台为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/
但我不知道为什么其他人没有这个问题,也不知道该怎么做。