问题描述
我正在尝试在 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.
谁能帮我增加堆大小?
您对我的帮助将不胜感激
Your help will be greatly appretiated to me
提前致谢.
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)
推荐答案
我刚刚遇到了同样的问题.
I've just run into same problem.
问题是运行jack的虚拟机内存不足.
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 服务器是使用 out/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 源代码时增加堆大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!