1 编译Android7.0+更改Java heap Size
Android7.0(也就是Android N)上默认使用JACK编译器,当内存较小的机器编译时可能会出现:
Out of memory error (version 1.2-rc4 ‘Carnac’ (298900 f95d7bdecfceb327f9d201a1348397ed8a843843 by [email protected])).
GC overhead limit exceeded.
Try increasing heap size with java option ‘-Xmx’.
此时需要更改Java heap Size,有2种方式任选:
方法1(不需要make clean,export后即可继续make xxxx):
export JACK_SERVER_VM_ARGUMENTS=”-Dfile.encoding=UTF-8 -XX:+TieredCompilation -Xmx4096m”
out/host/linux-x86/bin/jack-admin kill-server
out/host/linux-x86/bin/jack-admin start-server
方法2:
修改源码目录下prebuilts/sdk/tools/jack-admin文件的JACK_SERVER_VM_ARGUMENTS变量,
添加-Xmx4096M(这个根据你自己的内存情况),然后make clean,make -j48重新编译。
2 /usr/lib/x86_64-linux-gnu/libQt5Core.so.5: version `Qt_5.7’ not found (required by emulator64-x86)
Leave libQt5Core.so.5 in /home/wanyu/work/aosp/prebuilts/android-emulator/linux-x86_64/lib64/qt/. Qt does not like to be moved around, it makes it lose where the plugins are stored. In your case it might end up trying to load Qt 5.5 plugins.
Set LD_LIBRARY_PATH to /home/wanyu/work/aosp/prebuilts/android-emulator/linux-x86_64/lib64/qt/.
3.解决命令启动Android模拟器出现lib64OpenglRender.so: cannot open shared object file问题
export LD_LIBRARY_PATH=~/Android/sdk/tools/lib64:$LD_LIBRARY_PATH
4模拟器跑步起来
4.1
$ repo init -u https://android.googlesource.com/platform/manifest -b android-8.0.0_r34
$ repo sync -j12
4.2
https://android.googlesource.com/platform/frameworks/native/+/3adf9e1403bee30d1ef79c3a8cf310292df4745f
$ cd ../../
4.3
$ make -j4
4.4
emulator