标签:android 编译出错
在Android7.1编译过程中出现如下错误:
Starting build with ninjaninja: Entering directory `.‘ [ 0% 8/30301] Ensure Jack server is installed and startedJack server already installed in "/home/guochongxin/.jack-server"Launching Jack server java -XX:MaxJavaStackTraceDepth=-1 -Djava.io.tmpdir=/tmp -Dfile.encoding=UTF-8 -XX:+TieredCompilation -cp /home/guochongxin/.jack-server/launcher.jar com.android.jack.launcher.ServerLauncher[ 0% 10/30301] Building with Jack: out/target/common/obj/JAVA_LIBRARIES/libprotobuf-java-micro_intermediates/classes.jack[ 0% 12/30301] Building with Jack: out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/with-local/classes.dexFAILED: /bin/bash out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/with-local/classes.dex.rspOut of memory error (version 1.2-rc4 ‘Carnac‘ (298900 f95d7bdecfceb327f9d201a1348397ed8a843843 by android-jack-team@google.com)).GC overhead limit exceeded.Try increasing heap size with java option ‘-Xmx<size>‘.Warning: This may have produced partial or corrupted output.[ 0% 12/30301] Compiling SDK Stubs with Jack: out/target/comm...AVA_LIBRARIES/android_stubs_current_intermediates/classes.jackninja: build stopped: subcommand failed.make: *** [ninja_wrapper] Error 1
从上面的错误提示中可以看到如下一句:
Try increasing heap size with java option ‘-Xmx<size>‘.
按照上述发现的提示语句,我们对prebuilts/sdk/tools/jack-admin文件进行如下修改:1.找到如下语句:
JACK_SERVER_COMMAND="java -XX:MaxJavaStackTraceDepth=-1 -Djava.io.tmpdir=$TMPDIR $JACK_SERVER_VM_ARGUMENTS -cp $LAUNCHER_JAR $LAUNCHER_NAME"
2.将上述语句修改为:
JACK_SERVER_COMMAND="java -XX:MaxJavaStackTraceDepth=-1 -Djava.io.tmpdir=$TMPDIR $JACK_SERVER_VM_ARGUMENTS -Xmx4096m -cp $LAUNCHER_JAR $LAUNCHER_NAME"
主要是添加了-Xmx4096m参数,接下来在源码目录下执行如下命令重启jack-admin服务:
./prebuilts/sdk/tools/jack-admin stop-server
./prebuilts/sdk/tools/jack-admin start-server
重启完jack-admin服务后,此时再重新执行编译命令就能编译通过了。
本文出自 “帆布鞋也能走猫步” 博客,请务必保留此出处http://9409270.blog.51cto.com/9399270/1957117
标签:android 编译出错
原文地址:http://9409270.blog.51cto.com/9399270/1957117