Android 编译错误集锦

1.Out of memory error

在编译Android 8的时候遇到了内存不足的问题

/bin/bash: line 0: [: =: unary operator expected
[  3% 39/1150] Building with Jack: out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/with-local/classes.dex
FAILED: out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/with-local/classes.dex
/bin/bash out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/with-local/classes.dex.rsp
Out of memory error (version 1.3-rc7 'Douarn' (445000 d7be3910514558d6715ce455ce0861ae2f56925a by android-jack-team@google.com)).
Java heap space.
Try increasing heap size with java option '-Xmx'.
Warning: This may have produced partial or corrupted output.
[  3% 43/1150] Building with Jack: out/target/common/obj/JAVA_LIBRARIES/android-support-v14-preference_intermediates/classes.jack
ninja: build stopped: subcommand failed.
17:25:30 ninja failed with: exit status 1

#### failed to build some targets (12:01 (mm:ss)) ####

解决方案如下:

android_build$ export JACK_SERVER_VM_ARGUMENTS="-Dfile.encoding=UTF-8 -XX:+TieredCompilation -Xmx4g"
android_build$ ./prebuilts/sdk/tools/jack-admin kill-server
Killing background server
android_build$ ./prebuilts/sdk/tools/jack-admin start-server
Launching Jack server java -XX:MaxJavaStackTraceDepth=-1 -Djava.io.tmpdir=/tmp -Dfile.encoding=UTF-8 -XX:+TieredCompilation -Xmx4g -cp /home/nxa22007/.jack-server/launcher.jar com.android.jack.launcher.ServerLauncher

你可能感兴趣的:(Android)