Android模拟器的远程无头Ubuntu服务器(DigitalOcean)?

lyfkaqu1  于 2023-08-03  发布在  Android
关注(0)|答案(1)|浏览(107)

我对Android应用程序开发很陌生。
我想建立一个系统来自动测试Android应用程序。我目前有一个Ubuntu 16.04的远程服务器(一个拥有1GB RAM的DigitalOcean drop)。我还在那里下载并设置了AndroidSDK,并使用android create avd ...创建了一个模拟器。
看来DigitalOcean不支持KVM,我不得不用-qemu -no-kvm禁用它,否则会弹出硬件错误。
问题是:模拟器似乎启动了,但根据adb logcat,它加载库和其他软件大约半个小时,然后最终冻结在一个随机的地方,我只能用Ctrl-\强制退出。
这是否仅仅是因为模拟器启动非常慢?有办法解决吗?
或者,对于Android模拟器,是否有更好的替代品,可以在DigitalOcean服务器上从命令行运行?
谢谢你,谢谢
当我运行模拟器时:

$ emulator -avd Test1 -no-window -qemu -no-kvm
Error: unable to open display 
emulator: WARNING: Increasing RAM size to 1024MB
emulator: WARNING: VM heap size set below hardware specified minimum of 64MB
emulator: WARNING: Setting VM heap size to 256MB
emulator: WARNING: QEMU2 does not support snapshots - option will be ignored.
Error: unable to open display 
pulseaudio: pa_context_connect() failed
pulseaudio: Reason: Connection refused
pulseaudio: Failed to initialize PA contextaudio: Could not init `pa' audio driver
console on port 5554, ADB on port 5555   # stays on this line for 20 minutes
Quit (core dumped)                       # Ctrl-\ here

字符串
logcat的尾端:

D/NuPlayerDriver( 1144): start(0xb6250ca0)
I/GenericSource( 1144): start
I/Process ( 1498): Sending signal. PID: 1588 SIG: 3
I/Process ( 1498): Sending signal. PID: 1498 SIG: 3
I/art     ( 1498): Thread[3,tid=1503,WaitingInMainSignalCatcherLoop,Thread*=0xafc0d400,peer=0x12c02080,"Signal Catcher"]: reacting to signal 3
W/art     ( 1498): Suspending all threads took: 76.883ms
D/NuPlayerDriver( 1144): reset(0xb6250ca0)
I/art     ( 1588): Wrote stack traces to '/data/anr/traces.txt'
I/art     ( 1588): Thread[3,tid=1591,WaitingInMainSignalCatcherLoop,Thread*=0xafc0d400,peer=0x12c210e0,"Signal Catcher"]: reacting to signal 3
W/art     ( 1588): Suspending all threads took: 60.021ms
I/art     ( 1633): Wrote stack traces to '/data/anr/traces.txt'
I/art     ( 1588): Wrote stack traces to '/data/anr/traces.txt'
I/DownloadManager( 1633): Upgrading downloads database from version 0 to version 109, which will destroy all old data
I/dumpstate( 1800): begin
I/art     ( 1552): Thread[3,tid=1563,WaitingInMainSignalCatcherLoop,Thread*=0xb1505400,peer=0x746a5080,"Signal Catcher"]: reacting to signal 3
I/art     ( 1552): Wrote stack traces to '/data/anr/traces.txt'
I/art     ( 1588): Thread[3,tid=1591,WaitingInMainSignalCatcherLoop,Thread*=0xafc0d400,peer=0x12c210e0,"Signal Catcher"]: reacting to signal 3
I/art     ( 1613): Thread[3,tid=1618,WaitingInMainSignalCatcherLoop,Thread*=0xafc0d400,peer=0x12c07080,"Signal Catcher"]: reacting to signal 3
I/art     ( 1588): Wrote stack traces to '/data/anr/traces.txt'
I/art     ( 1633): Thread[3,tid=1641,WaitingInMainSignalCatcherLoop,Thread*=0xafc0d400,peer=0x22c12080,"Signal Catcher"]: reacting to signal 3
I/art     ( 1739): Thread[3,tid=1749,WaitingInMainSignalCatcherLoop,Thread*=0xafc0d400,peer=0x22c07080,"Signal Catcher"]: reacting to signal 3
I/art     ( 1613): Wrote stack traces to '/data/anr/traces.txt'
I/art     ( 1763): Thread[3,tid=1775,WaitingInMainSignalCatcherLoop,Thread*=0xafc0d400,peer=0x22c06140,"Signal Catcher"]: reacting to signal 3
I/art     ( 1739): Wrote stack traces to '/data/anr/traces.txt'
I/art     ( 1763): Wrote stack traces to '/data/anr/traces.txt'
I/art     ( 1633): Wrote stack traces to '/data/anr/traces.txt'
# Stopped here

j0pj023g

j0pj023g1#

1 GB RAM不足以使模拟器正常工作。因为系统将占用300-400 Mb的虚拟设备将没有足够的空闲RAM。
最好使用最低4 GB RAM的水滴(8 GB好得多)。
现在看来Digital Ocean支持KVM。至少我已经通过运行emulator -accel-check命令检查过了。这是一个结果

accel:
0
KVM (version 12) is installed and usable.
accel
enter code here

字符串

相关问题