不全面 Android Studio - Device emulator-5554 处于离线状态。错误 - 仅显示黑屏

Uncomprehensive Android Studio - Device emulator-5554 is offline. error - Showing only black screen

经过多次尝试,并尝试了很多我可以在 Whosebug 或互联网其他地方找到的解决方案,我仍然无法 运行 我的计算机上的模拟器。这台计算机在 Windows 和 Linux 启动时都会发生这种情况。我能够启动模拟器,但它仍然是全黑屏幕。 以下是有关该软件的一些信息:Linux Ubuntu 20.04LTS 和 Android-studio 我正在使用的版本:4.1.2。 关于我的硬件:

$sudo lshw -short
 
H/W path         Device     Class          Description
======================================================
                            system         GA-A75M-S2V
/0                          bus            GA-A75M-S2V
/0/0                        memory         128KiB BIOS
/0/4                        processor      AMD A8-3870 APU with Radeon(tm) HD Graphics
/0/4/a                      memory         128KiB L1 cache
/0/4/c                      memory         1MiB L3 cache
/0/b                        memory         128KiB L1 cache
/0/26                       memory         8GiB System Memory
/0/26/0                     memory         4GiB DIMM 1333 MHz (0.8 ns)
/0/26/1                     memory         4GiB DIMM 1333 MHz (0.8 ns)
/0/26/2                     memory         DIMM 1333 MHz (0.8 ns) [empty]
/0/26/3                     memory         DIMM 1333 MHz (0.8 ns) [empty]
/0/100                      bridge         Family 12h Processor Root Complex
/0/100/2                    bridge         Family 12h Processor Root Port
/0/100/2/0                  display        GK104 [GeForce GTX 670]
/0/100/2/0.1                multimedia     GK104 HDMI Audio Controller
/0/100/4                    bridge         Family 12h Processor Root Port
/0/100/4/0       enp2s0     network        RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller

首先我检查了虚拟化是否正常工作,看起来还不错。

$ lscpu
Architecture:                    x86_64
CPU op-mode(s):                  32-bit, 64-bit
Byte Order:                      Little Endian
Address sizes:                   40 bits physical, 48 bits virtual
CPU(s):                          4
On-line CPU(s) list:             0-3
Thread(s) per core:              1
Core(s) per socket:              4
Socket(s):                       1
NUMA node(s):                    1
Vendor ID:                       AuthenticAMD
CPU family:                      18
Model:                           1
Model name:                      AMD A8-3870 APU with Radeon(tm) HD Graphics
Stepping:                        0
CPU MHz:                         1395.339
CPU max MHz:                     3000.0000
CPU min MHz:                     800.0000
BogoMIPS:                        5999.33
Virtualization:                  AMD-V
L1d cache:                       256 KiB
L1i cache:                       256 KiB
L2 cache:                        4 MiB
NUMA node0 CPU(s):               0-3
Vulnerability Itlb multihit:     Not affected
Vulnerability L1tf:              Not affected
Vulnerability Mds:               Not affected
Vulnerability Meltdown:          Not affected
Vulnerability Spec store bypass: Not affected
Vulnerability Spectre v1:        Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Vulnerability Spectre v2:        Mitigation; Full AMD retpoline, STIBP disabled, RSB filling
Vulnerability Srbds:             Not affected
Vulnerability Tsx async abort:   Not affected
Flags:                           fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm 3dnowext 3dnow constant_tsc rep_
                                 good nopl nonstop_tsc cpuid extd_apicid aperfmperf pni monitor cx16 popcnt lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs skinit wdt hw_ps
                                 tate vmmcall arat npt lbrv svm_lock nrip_save pausefilter

然后我尝试了二次验证!

$ virt-host-validate
QEMU: Checking for hardware virtualization    : PASS

flutter doctor写的是设备离线,我全黑屏。 在这里我尝试了很多东西,用硬件或软件渲染的图形,改变 RAM,改变核心数,改变 x86 或 x86_64 CPU arch,... $flutter doctor

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 1.22.5, on Linux, locale en_US.UTF-8)
 
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[!] Android Studio
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
[✓] VS Code (version 1.52.1)
[!] Connected device
    ! Device emulator-5554 is offline.

! Doctor found issues in 2 categories.
                                                                                                                                                                             

并且在执行 adb devices 命令时:

$adb devices

List of devices attached 
adb server version (41) doesn't match this client (39); killing...
* daemon started successfully

                                

最后我总是收到这个错误:等待模拟器上线 300 秒后超时。

我尝试做 adb server-killer 等,做冷启动等,...没有任何效果。我仍然遇到完全相同的问题。 以前我使用的是另一台一切正常的计算机。而我在这里完全挣扎。

$adb kill-server
$adb start-server
* daemon not running; starting now at tcp:5037
* daemon started successfully

当 运行ning logcat 我有一个重启循环。

$./emulator -avd Pixel_2_API_30 -debug-init -logcat '*:v'
emulator: Android emulator version 30.3.5.0 (build_id 7033400) (CL:N/A)
emulator: Found AVD name 'Pixel_2_API_30'
emulator: Found AVD target architecture: x86

...
[    1.453200] Run /init as init process
[    1.454227] traps: init[1] trap invalid opcode ip:59434e sp:ffa11a60 error:0 in init[462000+139000]
[    1.455590] Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000004
[    1.456724] CPU: 0 PID: 1 Comm: init Not tainted 5.4.61-android11-0-00791-gbad091cc4bf3-ab6833933 #1
[    1.458050] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.11.1-0-g0551a4be2c-prebuilt.qemu-project.org 04/01/2014
[    1.459787] Call Trace:
[    1.460170]  dump_stack+0x95/0xe5
[    1.460702]  panic+0x112/0x39a
[    1.461069]  do_exit+0xa99/0xb00
[    1.461455]  do_group_exit+0x89/0xa0
[    1.461887]  get_signal+0x999/0xae0
[    1.462306]  ? _raw_spin_unlock_irqrestore+0x1a/0x40
[    1.462890]  ? force_sig_info_to_task+0x111/0x120
[    1.463641]  do_signal+0x80/0x250
[    1.464039]  prepare_exit_to_usermode+0x8d/0x100
[    1.464589]  ? invalid_op+0xa/0x30
[    1.464993]  retint_user+0x8/0x8
[    1.465378] RIP: 0023:0x59434e
[    1.465743] Code: f7 83 e1 03 c1 e6 0c c1 e1 0a 09 d6 0f b6 d3 8b 5c 24 0c 09 d1 8b 55 08 09 f1 81 c9 00 01 00 00 66 0f 6e c1 8b 92 40 95 00 00 <f2> 0f 38 f1 d3 f2 0f 38 f1 d1 f2 0f 38 f1 d0 0f b7 c0 89 d6 c1 ee
[    1.468434] RSP: 002b:00000000ffa11a60 EFLAGS: 00010202
[    1.469069] RAX: 0000000000000000 RBX: 00000000f7f80a60 RCX: 0000000000018102
[    1.469901] RDX: 0000000051746398 RSI: 0000000000018000 RDI: 0000000000000018
[    1.470732] RBP: 00000000ffa11a98 R08: 0000000000000000 R09: 0000000000000000
[    1.471564] R10: 0000000000000000 R11: 0000000000000216 R12: 0000000000000000
[    1.472394] R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
[    1.473344] Kernel Offset: 0x29000000 from 0xffffffff81000000 (relocation range: 0xffffffff80000000-0xffffffffbfffffff)
[    1.475542] Rebooting in 5 seconds..
emulator: No acpi ini file provided, using default
...

你知道我可能遗漏了什么吗?我无法 post 图片。 我希望你能帮助我。 非常感谢,

我终于找到了解决办法。 因为我使用的是旧的 AMV 处理器,所以我需要为模拟器使用基于 ARM 的映像,而不是 x86 映像。 然后我就可以 运行 它了。 不幸的是,我的处理器不够强大,并且在启动 android 模拟器时非常滞后。 不得不买一台新电脑。