Android源码下载与编译过程记录

Android 6.0百度网盘下载 

1、Android源码下载

参考了以下的下载失败重下载脚本:

[linuxidc@localhost android-src]$ cat myrepo.sh
#!/bin/sh
repo sync
while [ $? -ne 0 ]
do
    echo "try repo sync again"
    repo sync
done
[linuxidc@localhost android-src]$

下班前开始跑,第二天就有了。

2、编译第一次直接进入下载的源代码目录,运行make,过了3个多小时后,报错:

[ 31% 9980/31772] host Java: bouncycastle-host (out/host/common/obj/JAVA_LIBRARIES/bouncycastle-host_intermediates/classes)
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
[ 31% 9983/31772] host Java: bouncycastle-bcpkix-host (out/host/common/obj/JAVA_LIBRARIES/bouncycastle-bcpkix-host_intermediates/classes)
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
[ 31% 9987/31772] Build: out/host/linux-x86/obj/EXECUTABLES/jack_intermediates/jack
Writing client settings in /home/gumh/.jack-settings
Installing jack server in "/home/gumh/.jack-server"
Launching Jack server java -Djava.io.tmpdir=/tmp -Dfile.encoding=UTF-8 -XX:+TieredCompilation -cp /home/gumh/.jack-server/launcher.jar com.android.jack.launcher.ServerLauncher
[ 31% 10007/31772] host C++: zipalign <= build/tools/zipalign/ZipEntry.cpp
build/tools/zipalign/ZipEntry.cpp:145:52: warning: unused parameter 'pZipFile' [-Wunused-parameter]
status_t ZipEntry::initFromExternal(const ZipFile* pZipFile,
                                                  ^
build/tools/zipalign/ZipEntry.cpp:151:12: warning: destination for this 'memcpy' call is a pointer to dynamic class 'CentralDirEntry'; vtable pointer will be overwritten [-Wdynamic-class-memaccess]
    memcpy(&mCDE, &pEntry->mCDE, sizeof(mCDE));
    ~~~~~~ ^
build/tools/zipalign/ZipEntry.cpp:151:12: note: explicitly cast the pointer to silence this warning
    memcpy(&mCDE, &pEntry->mCDE, sizeof(mCDE));
          ^
          (void*)
2 warnings generated.
[ 31% 10012/31772] host C: libzopfli <= external/zopfli/src/zopfli/lz77.c
external/zopfli/src/zopfli/lz77.c:95:60: warning: unused parameter 'datasize' [-Wunused-parameter]
void ZopfliVerifyLenDist(const unsigned char* data, size_t datasize, size_t pos,
                                                          ^
1 warning generated.

[ 31% 10040/31772] Building with Jack: out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/with-local/classes.dex
FAILED: /bin/bash out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/with-local/classes.dex.rsp
GC overhead limit exceeded
Try increasing heap size with java option '-Xmx<size>'
Warning: This may have produced partial or corrupted output.
ninja: build stopped: subcommand failed.

make: *** [ninja_wrapper] Error 1
[linuxidc@localhost android-src]$

//---2015-11-13--//

make之前还运行了下面的指令:

#source ./build/envsetup.sh

这个命令选择你的编译环境的硬件体系

#lunch

下面这个命令就开始编译了

#make

通过跟踪顶层makefile,找到有关jack的目录:prebuilts/sdk/tools,其中看到有个jack-admin,正是启动jack所在的shell。里面有个设置:

#
# Settings
#
JACK_HOME="${JACK_HOME:=$HOME/.jack-server}"
CLIENT_SETTING="${CLIENT_SETTING:=$HOME/.jack-settings}"
TMPDIR=${TMPDIR:=/tmp}
JACK_SERVER_VM_ARGUMENTS="${JACK_SERVER_VM_ARGUMENTS:=-Dfile.encoding=UTF-8 -XX:+TieredCompilation}"

修改一下,增加-Xmx2048M:

#
# Settings
#
JACK_SERVER_VM_ARGUMENTS="${JACK_SERVER_VM_ARGUMENTS:=-Dfile.encoding=UTF-8 -XX:+TieredCompilation -Xmx:2048M}"

再次make,好像没起作用:

[  1% 296/20841] Build: out/host/linux...bj/EXECUTABLES/jack_intermediates/jack
Jack server already installed in "/home/gumh/.jack-server"
Launching Jack server java -Djava.io.tmpdir=/tmp -Dfile.encoding=UTF-8 -XX:+TieredCompilation -cp /home/gumh/.jack-server/launcher.jar com.android.jack.launcher.ServerLauncher

找到jack-admin中的start-server语句,直接在里面增加:

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/15058.html