在Ubuntu 15.10上构建android源代码时增加堆大小 [英] Increasing heap size while building the android source code on Ubuntu 15.10

查看:241
本文介绍了在Ubuntu 15.10上构建android源代码时增加堆大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在ubuntu 15.10中构建android源代码,但是我收到了一个错误。现在我希望你的帮助来构建android源代码。

I am trying to build the android source code in ubuntu 15.10, but I got an error. Now I want your help to build the android source code.

including ./tools/external/fat32lib/Android.mk ...
Starting build with ninja
ninja: Entering directory `.'
[  0% 1/21542] Ensure Jack server is installed and started
Jack server already installed in "/home/smile/.jack-server"
Server is already running
[  0% 2/21542] Building with Jack: out/target/common/obj/JAVA_LIBRARIES/core-all_intermediates/with-local/classes.dex
FAILED: /bin/bash out/target/common/obj/JAVA_LIBRARIES/core-all_intermediates/with-local/classes.dex.rsp
Java heap space
Try increasing heap size with java option '-Xmx<size>'
Warning: This may have produced partial or corrupted output.
ninja: build stopped: subcommand failed.
build/core/ninja.mk:146: recipe for target 'ninja_wrapper' failed
make: *** [ninja_wrapper] Error 1

#### make failed to build some targets (08:25 (mm:ss)) ####

然后我跑 $ java -Xmx2048m命令我得到了一些代码:

Then I run "$ java -Xmx2048m" command and I get some lines:

 smile@smile:~/Android$ java -Xmx2048m
Usage: java [-options] class [args...]
           (to execute a class)
   or  java [-options] -jar jarfile [args...]
           (to execute a jar file)
where options include:
    -d32      use a 32-bit data model if available
    -d64      use a 64-bit data model if available
    -server   to select the "server" VM
    -zero     to select the "zero" VM
    -jamvm    to select the "jamvm" VM
    -avian    to select the "avian" VM
    -dcevm    to select the "dcevm" VM
                  The default VM is server.

    -cp <class search path of directories and zip/jar files>
    -classpath <class search path of directories and zip/jar files>
                  A : separated list of directories, JAR archives,
                  and ZIP archives to search for class files.
    -D<name>=<value>
                  set a system property
    -verbose:[class|gc|jni]
                  enable verbose output
    -version      print product version and exit
    -version:<value>
                  require the specified version to run
    -showversion  print product version and continue
    -jre-restrict-search | -no-jre-restrict-search
                  include/exclude user private JREs in the version search
    -? -help      print this help message
    -X            print help on non-standard options
    -ea[:<packagename>...|:<classname>]
    -enableassertions[:<packagename>...|:<classname>]
                  enable assertions with specified granularity
    -da[:<packagename>...|:<classname>]
    -disableassertions[:<packagename>...|:<classname>]
                  disable assertions with specified granularity
    -esa | -enablesystemassertions
                  enable system assertions
    -dsa | -disablesystemassertions
                  disable system assertions
    -agentlib:<libname>[=<options>]
                  load native agent library <libname>, e.g. -agentlib:hprof
                  see also, -agentlib:jdwp=help and -agentlib:hprof=help
    -agentpath:<pathname>[=<options>]
                  load native agent library by full pathname
    -javaagent:<jarpath>[=<options>]
                  load Java programming language agent, see java.lang.instrument
    -splash:<imagepath>
                  show splash screen with specified image
See http://www.oracle.com/technetwork/java/javase/documentation/index.html for more details.

谁能帮助我如何增加堆大小?

Who can help me how to increase heap size?

我的帮助会非常适合我

提前致谢。

smile@smile:~/Android$ java -version
java version "1.7.0_91"
OpenJDK Runtime Environment (IcedTea 2.6.3) (7u91-2.6.3-0ubuntu0.15.10.1)
OpenJDK 64-Bit Server VM (build 24.91-b01, mixed mode)


推荐答案

我遇到了同样的问题。

问题是运行插孔的虚拟机没有足够的内存。

The problem is that virtual machine which runs jack doesn't have enough memory.

您可以尝试编辑jvm命令:

You can try to edit jvm command:

JACK_VM_COMMAND=${JACK_VM_COMMAND:="java -Xmx4096m"}

或减少并行插孔编号的数量

or to decrease number of parallel jack compilations

SERVER_NB_COMPILE=2

〜/ .jack 文件中。

您可以阅读 jack文档了解详情。

编辑:
更改.jack文件对我不起作用。
深入挖掘之后,我发现jack服务器是以/ host / linux-x86 / bin / jack-admin脚本启动的,它的参数可以通过JACK_SERVER_VM_ARGUMENTS环境变量传递。

Changing .jack file didn't work for me. After digging a little deeper I found that jack server is started with out/host/linux-x86/bin/jack-admin script and it's parameters can be passed with JACK_SERVER_VM_ARGUMENTS environment variable.

所以我的解决方案是在构建aosp之前设置它并重新启动jack服务器:

So my solution was to set it and restart jack server before building aosp :

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

这篇关于在Ubuntu 15.10上构建android源代码时增加堆大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆