我通过遵循this guide但使用最新的android sdk工具(sdkmanager
和avdmanager
)来预装了一个使用ubuntu 16.04在无业游民的盒子中使用apache cordova的android开发环境。
使用sdkmanager我安装了以下软件包:
Installed packages:
Path | Version | Description | Location
------- | ------- | ------- | -------
build-tools;26.0.2 | 26.0.2 | Android SDK Build-Tools 26.0.2 | build-tools/26.0.2/
emulator | 28.0.20 | Android Emulator | emulator/
patcher;v4 | 1 | SDK Patch Applier v4 | patcher/v4/
platform-tools | 28.0.1 | Android SDK Platform-Tools | platform-tools/
platforms;android-27 | 3 | Android SDK Platform 27 | platforms/android-27/
system-images;android-27;default;x86_64 | 1 | Intel x86 Atom_64 System Image | system-images/android-27/default/x86_64/
tools | 26.1.1 | Android SDK Tools 26.1.1 | tools/
虽然我使用此avdmanager
命令构建仿真设备
avdmanager --verbose create avd --sdcard 2048M --name 'Android-27' -d 1 -k "system-images;android-27;default;x86_64"
然后,当尝试使用cordova emulate android
模拟其文件夹内的应用程序时,出现以下错误:
BUILD SUCCESSFUL in 1s
46 actionable tasks: 1 executed, 45 up-to-date
Built the following apk(s):
/home/vagrant/hello/platforms/android/app/build/outputs/apk/debug/app-debug.apk
ANDROID_HOME=/opt/android-sdk-linux
JAVA_HOME=/usr/lib/jvm/java-8-oracle
No emulator specified, defaulting to Android-27
Waiting for emulator to start...
emulator: ERROR: Not enough disk space to run AVD 'Android-27'. Exiting...
然后尝试通过在~/.android/avd/Android-27.avd/config.ini
文件内添加以下行来解决该问题
disk.dataPartition.size=2048MB
但没有成功。
这是蜜蜂解决的无聊问题还是avd的问题?
欢迎提出任何想法或提示。
编辑:
我安装了vagrant-disksize并调整了磁盘最大20GB的大小,但错误消失了,但另一个错误代替了它:p
emulator: ERROR: x86_64 emulation currently requires hardware acceleration!
Please ensure KVM is properly installed and usable.
CPU acceleration status: KVM requires a CPU that supports vmx or svm
编辑2:
我最终使用system-images;android-25;android-wear;armeabi-v7a
而不是system-images;android-27;default;x86_64
现在当模拟器启动时,X11似乎崩溃并打印出
No emulator specified, defaulting to Android-27
Waiting for emulator to start...
emulator: Requested console port 5584: Inferring adb port 5585.
emulator: WARNING: encryption is off
pulseaudio: pa_context_connect() failed
pulseaudio: Reason: Connection refused
pulseaudio: Failed to initialize PA contextaudio: Could not init `pa' audio driver
X Error of failed request: BadRequest (invalid request code or no such operation)
Major opcode of failed request: 130 (MIT-SHM)
Minor opcode of failed request: 1 (X_ShmAttach)
Serial number of failed request: 14
Current serial number in output stream: 15
也许我应该更改帖子标题。