记录 AOSP 编译遇到的各种报错及解决方式

FAILED: /bin/bash out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/with-local/classes.dex.rsp
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’.
Warning: This may have produced partial or corrupted output.
[ 32% 12025/36462] build out/target/common/obj/JAVA_LIBRARIES/sdk_v20_intermediates/classes.jack
ninja: build stopped: subcommand failed.
make: *** [ninja_wrapper] Error 1

export ANDROID_JACK_VM_ARGS="-Dfile.encoding=UTF-8 -XX:+TieredCompilation -Xmx4G"
修改Jack的配置文件prebuilts/sdk/tools/jack-admin
这是一个管理Jack的shell脚本,找到start-server函数,直接修改其启动参数,由原来的
JACK_SERVER_COMMAND="java -XX:MaxJavaStackTraceDepth=-1 -Djava.io.tmpdir=$TMPDIR $JACK_SERVER_VM_ARGUMENTS -cp $LAUNCHER_JAR $LAUNCHER_NAME"
更改为
JACK_SERVER_COMMAND="java -XX:MaxJavaStackTraceDepth=-1 -Djava.io.tmpdir=$TMPDIR $JACK_SERVER_VM_ARGUMENTS -Xmx4096m -cp $LAUNCHER_JAR $LAUNCHER_NAME"
此时Jack服务器仍然在后台执行,所以我们需要将其停止,然后重启启动(make会自动启动Jack服务器)才能使得修改后的参数生效。
我们执行下面的命令此时Jack服务器仍然在后台执行,所以我们需要将其停止,然后重启启动(make会自动启动Jack服务器)才能使得修改后的参数生效。
我们执行下面的命令:
先停止服务
./prebuilts/sdk/tools/jack-admin stop-server
重新开始服务
./prebuilts/sdk/tools/jack-admin start-server
详细的错误日志里边列出了问题并且已经给出了解决方案 - 增加Java虚拟机的-Xmx大小,即设置一个较大的堆内存上限。

设置cache 增加编译速度

export USE_CCACHE=1
export CCACHE_EXEC=/usr/bin/ccache
ccache -M 50G

问题:adb remount 后提示
dm_verity is enabled on the system partition.
Use “adb disable-verity” to disable verity.
If you do not, remount may succeed, however, you will still not be able to write to these volumes.
remount of /system failed: Read-only file system
remount failed

解决办法:
执行 adb disable-verity
提示:Verity disabled on /system
Now reboot your device for settings to take effect

然后重启 :adb reboot

参考:http://blog.chinaunix.net/uid-29287191-id-4858970.html

问:
How to just build Android system image
答案:
If your changes effect other applications, use make systemimage, otherwise use make snod.

Notice:make systemimage will check dependency during compile progress, while make snod will not do this check, so the former command need more time than the latter.

参考:
https://stackoverflow.com/questions/29023406/how-to-just-build-android-system-image

你可能感兴趣的:(杂记,android)