追风赶月莫停留,平芜尽处是春山。这篇文章主要讲述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 [email protected])).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服务后,此时再重新执行编译命令就能编译通过了。
【Android系统编译出错】本文出自 “帆布鞋也能走猫步” 博客,请务必保留此出处http://9409270.blog.51cto.com/9399270/1957117
推荐阅读
- ORB_SLAM2_Android
- 安卓学习资料
- sql数据库连接字符串在APP.config配置文件内的两种写法
- Android 手把手带你玩转自己定义相机
- 使用Android Studio进行NDK开发
- 安卓 内容提供者 观察者解析器
- 什么是混合app开发
- Android MediaScanner 总纲
- 安卓 碎片 如何实现类似 活动 栈的 进栈 出栈