Ubuntu18.04上编译AOSP最新版(Android Pie)遇到的问题及解决方法

在使用Ubuntu18.04 编译(build) AOSP时,遇到了以下错误。

一开始我选择lunch的是aosp_arm64-eng,即:

source build/envsetup.sh
lunch aosp_arm64-eng
make -j16 #取决于机器的cpu核心数量
emulator

但是运行emulator之后,在输出信息没有error或者failed的情况下,emulator一直卡在boot界面,即"android"闪烁的界面。

使用adb logcat可以获取到以下日志信息:

11-28 12:17:31.011 1126 1126 I ServiceManagement: getService: Trying again for [email protected]::IDevicesFactory/default…
11-28 12:17:31.024 1273 1869 I ServiceManager: Waiting for service ‘media.audio_policy’ on ‘/dev/binder’…
11-28 12:17:31.871 1273 1869 I chatty : uid=1000(system) AudioService identical 8 lines
11-28 12:17:31.975 1273 1869 I ServiceManager: Waiting for service ‘media.audio_policy’ on ‘/dev/binder’…
11-28 12:17:32.013 1126 1126 W ServiceManagement: Waited one second for [email protected]::IDevicesFactory/default
11-28 12:17:32.023 1126 1126 I ServiceManagement: getService: Trying again for [email protected]::IDevicesFactory/default…
11-28 12:17:32.079 1273 1869 I ServiceManager: Waiting for service ‘media.audio_policy’ on ‘/dev/binder’…
11-28 12:17:32.827 1273 1869 I chatty : uid=1000(system) AudioService identical 7 lines
11-28 12:17:32.930 1273 1869 I ServiceManager: Waiting for service ‘media.audio_policy’ on ‘/dev/binder’…
11-28 12:17:33.025 1126 1126 W ServiceManagement: Waited one second for [email protected]::IDevicesFactory/default
11-28 12:17:33.034 1273 1869 I ServiceManager: Waiting for service ‘media.audio_policy’ on ‘/dev/binder’…
11-28 12:17:33.047 1126 1126 I ServiceManagement: getService: Trying again for [email protected]::IDevicesFactory/default…
11-28 12:17:33.139 1273 1869 I ServiceManager: Waiting for service ‘media.audio_policy’ on ‘/dev/binder’…
11-28 12:17:33.866 1273 1869 I chatty : uid=1000(system) AudioService identical 7 lines
11-28 12:17:33.969 1273 1869 I ServiceManager: Waiting for service ‘media.audio_policy’ on ‘/dev/binder’…
11-28 12:17:34.049 1126 1126 W ServiceManagement: Waited one second for [email protected]::IDevicesFactory/default
11-28 12:17:34.063 1126 1126 I ServiceManagement: getService: Trying again for [email protected]::IDevicesFactory/default…
11-28 12:17:34.073 1273 1869 I ServiceManager: Waiting for service ‘media.audio_policy’ on ‘/dev/binder’…
11-28 12:17:34.925 1273 1869 I chatty : uid=1000(system) AudioService identical 8 lines
11-28 12:17:35.029 1273 1869 I ServiceManager: Waiting for service ‘media.audio_policy’ on ‘/dev/binder’…
11-28 12:17:35.065 1126 1126 W ServiceManagement: Waited one second for [email protected]::IDevicesFactory/default
11-28 12:17:35.091 1126 1126 I ServiceManagement: getService: Trying again for [email protected]::IDevicesFactory/default…
11-28 12:17:35.132 1273 1869 I ServiceManager: Waiting for service ‘media.audio_policy’ on ‘/dev/binder’…
11-28 12:17:35.339 1273 1869 I chatty : uid=1000(system) AudioService identical 2 lines
11-28 12:17:35.443 1273 1869 I ServiceManager: Waiting for service ‘media.audio_policy’ on ‘/dev/binder’…
11-28 12:17:35.546 1273 1869 W ServiceManager: Service media.audio_policy didn’t start. Returning NULL
11-28 12:17:35.547 1273 1869 W AudioSystem: AudioPolicyService not published, waiting…
11-28 12:17:36.053 1273 1869 I ServiceManager: Waiting for service ‘media.audio_policy’ on ‘/dev/binder’…
11-28 12:17:36.111 1126 1126 W ServiceManagement: Waited one second for [email protected]::IDevicesFactory/default
11-28 12:17:36.118 1126 1126 I ServiceManagement: getService: Trying again for [email protected]::IDevicesFactory/default…

于是Google走起,,,但是无济于事。

后来发现lunch的target似乎是平台相关的。于是将aosp_arm64-eng改为aosp_x86_64-eng,重新编译后,遇到以下问题:

emulator: ERROR: x86_64 emulation currently requires hardware acceleration!
Please ensure KVM is properly installed and usable.
CPU acceleration status: This user doesn’t have permissions to use KVM (/dev/kvm)

StackOverflow中的解决方案是sudo chmod -R 777 /dev/kvm

最后终于能运行emulator了。

你可能感兴趣的:(环境搭建)