编译之前最好先把需要的包全装了
sudo apt-get install build-essential make gcc g++ libc6-dev texinfo libncurses-dev git-core gnupg flex bison zip curl ncurses-dev libsdl-dev zlib1g-dev ia32-libs libxml2-utils lzma
1.
build/core/config.mk:365: *** Error: could not find jdk tools.jar, please install JDK6, which you can download from java.sun.com。 停止。
我是配置了java 环境变量之后,使用 source /etc/profile使环境生效,然后直接make,就出现上面的问题,尽管在shell窗口输入 java javac等命令显示的刚才安装的jdk,这时试着把电脑注销启动之后就没问题了,应该是环境变量还未真正生效?
2.
build/core/java.mk:258: *** bin: Target java module does not define any source or resource files。 停止。
删除android源码根目录下的bin目录,因为自己之前使用了eclipse导入该源码,eclipse便会生成这个目录,删除再make即可。
3.
prebuilts/tools/gcc-sdk/g++: 行 40: prebuilts/tools/gcc-sdk/../../gcc/linux-x86/host/i686-linux-glibc2.7-4.6/bin/i686-linux-g++: 没有那个文件或目录
make: *** [out/host/linux-x86/obj/EXECUTABLES/validatekeymaps_intermediates/Main.o] 错误 127
输入:
apt-get install g++-multilib
4.
/android4.4/prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6/bin/../lib/gcc/i686-linux/4.6.x-google/../../../../i686-linux/bin/as: error while loading shared libraries: libz.so.1: cannot open shared object file: No such file or directory
make: *** [out/host/linux-x86/obj/EXECUTABLES/validatekeymaps_intermediates/Main.o] 错误 1
输入:
sudo apt-get install apt-file
sudo apt-file update
接着再输入 make,还是报与上面一样的错,网上查找查看链接,可以先不输入 sudp apt-file update。输入 apt-get install apt-file之后再输入命令:
apt-file search libz.so
显示:
lib32z1: /usr/lib32/libz.so.1
lib32z1: /usr/lib32/libz.so.1.2.3.3 lib32z1-dev: /usr/lib32/libz.so lsb-build-base3: /usr/lib/lsb3/libz.so zlib1g: /lib/libz.so.1 zlib1g: /lib/libz.so.1.2.3.3 zlib1g-dbg: /usr/lib/debug/lib/libz.so.1.2.3.3 zlib1g-dbg: /usr/lib/debug/usr/lib32/libz.so.1.2.3.3 zlib1g-dev: /usr/lib/libz.so
于是使用 apt-get install 依次安装上面的模块,再执行make
5.
external/doclava/src/com/google/doclava/Doclava.java:1315: 找不到符号
符号: 类 ClassDoc
位置: 类 com.google.doclava.Doclava
ClassDoc classDoc = (ClassDoc) doc;
^
external/doclava/src/com/google/doclava/Doclava.java:1315: 找不到符号
符号: 类 ClassDoc
位置: 类 com.google.doclava.Doclava
ClassDoc classDoc = (ClassDoc) doc;
^
external/doclava/src/com/google/doclava/Doclava.java:1324: 找不到符号
符号: 类 ClassDoc
位置: 类 com.google.doclava.Doclava
ClassDoc current = classDoc;
^
external/doclava/src/com/google/doclava/Doclava.java:1355: 找不到符号
符号: 类 Doc
位置: 类 com.google.doclava.Doclava
if ((entry instanceof Doc) && isHidden((Doc) entry)) {
^
external/doclava/src/com/google/doclava/Doclava.java:1355: 找不到符号
符号: 类 Doc
位置: 类 com.google.doclava.Doclava
if ((entry instanceof Doc) && isHidden((Doc) entry)) {
^
external/doclava/src/com/google/doclava/Doclava.java:1391: 找不到符号
符号: 类 Type
位置: 类 com.google.doclava.Doclava.HideHandler
if (proxy instanceof Type && methodName.equals("toString")) {
136 错误
make: *** [out/host/common/obj/JAVA_LIBRARIES/doclava_intermediates/javalib.jar] 错误 41
原来是我的jdk环境配置问题,见stackoverflow
我之前的环境配置是;
export JAVA_HOME=/usr/local/jdk1.6.0_45
export JRE_HOME=/usr/local/jdk1.6.0_45/jre
export CLASSPATH=.:$JAVA_HOME/lib/:$JRE_HOME/lib/:$CLASSPATH
export PATH=$JAVA_HOME/bin/:$JRE_HOME/bin/:$PATH
要改为:
export JAVA_HOME=/usr/local/jdk1.6.0_45
export JRE_HOME=/usr/local/jdk1.6.0_45/jre
export CLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH
export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH
注意二者的区别,改完后的 PATH和CLASSPATH之后的bin和lib后面均没有 “/”。
6.
prebuilts/misc/linux-x86/bison/bison -d -o out/host/linux-x86/obj/EXECUTABLES/aidl_intermediates/aidl_language_y.cpp frameworks/base/tools/aidl/aidl_language_y.y
prebuilts/misc/linux-x86/bison/bison: m4 子进程失败
make: *** [out/host/linux-x86/obj/EXECUTABLES/aidl_intermediates/aidl_language_y.cpp] 错误 1
输入命令:
sudo apt-get install bison
7.
Lex: aidl <= frameworks/base/tools/aidl/aidl_language_l.l
/bin/bash: flex: 未找到命令
make: *** [out/host/linux-x86/obj/EXECUTABLES/aidl_intermediates/aidl_language_l.cpp] 错误 127
输入命令:
sudo apt-get install flex
8.
Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_CSSPropertyNames (out/target/product/generic/obj/GYP/shared_intermediates/blink/CSSPropertyNames.cpp)
Traceback (most recent call last):
File "scripts/make_css_property_names.py", line 238, in <module>
in_generator.Maker(CSSPropertiesWriter).main(sys.argv)
File "/android4.4/external/chromium_org/third_party/WebKit/Source/core/scripts/in_generator.py", line 119, in main
writer.write_files(options.output_dir)
File "/android4.4/external/chromium_org/third_party/WebKit/Source/core/scripts/in_generator.py", line 77, in write_files
self._write_file(output_dir, generator(), file_name)
File "scripts/make_css_property_names.py", line 233, in generate_implementation
gperf = subprocess.Popen(gperf_args, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
File "/usr/lib/python2.7/subprocess.py", line 679, in __init__
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1249, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
make: *** [out/target/product/generic/obj/GYP/shared_intermediates/blink/CSSPropertyNames.cpp] 错误 1
这是由于没有安装 git导致的,输入命令:
sudo apt-get install git
再次make,结果还是出现同样的错误
干脆把下面的环境都安装:
git
gnupg
flex
bison
gperf
build-essential
zip
curl
libc6-dev
x11proto-core-dev
g++-multilib
tofrodos
python-markdown
libxml2-utils
xsltproc
一个一个安装,如果已经安装了,ubuntu会自己提示已经安装
9.
Gyp action: third_party_WebKit_Source_core_core_derived_sources_gyp_make_derived_sources_target_HTMLNames (out/target/product/generic/obj/GYP/shared_intermediates/blink/HTMLNames.cpp)
sh: 1: /usr/bin/gcc: not found
Failed to read names from file: /android4.4/external/chromium_org/third_party/WebKit/Source/core/html/HTMLTagNames.in at /android4.4/external/chromium_org/third_party/WebKit/Source/core/scripts/make_names.pl line 282.
Traceback (most recent call last):
File "scripts/action_makenames.py", line 182, in <module>
sys.exit(main(sys.argv))
File "scripts/action_makenames.py", line 164, in main
assert returnCode == 0
AssertionError
make: *** [out/target/product/generic/obj/GYP/shared_intermediates/blink/HTMLNames.cpp] 错误 1
出现 sh: 1: /usr/bin/gcc: not found错误,难道gcc没装,那就装吧
输入命令:
sudo apt-get install gcc
启动模拟器
1.
emulator: ERROR: You did not specify a virtual device name, and the system
directory could not be found.
If you are an Android SDK user, please use '@<name>' or '-avd <name>'
to start a given virtual device (see -help-avd for details).
Otherwise, follow the instructions in -help-disk-images to start the emulator
解决:
source build/envsetup.sh
lunch sdk-eng
然后再执行
emulator
编译内核
1.
ERROR: include/asm is a directory but a symlink was expected
make: *** [include/asm] 错误 1
解决方法:
删除源码根目录下的include/asm,文件夹,问题解决。
kernel/include/asm 文件夹是内核编译过程中创建的,创建结果就是一个指向文件夹asm-arm的链接,表明该系统的平台是arm架构的,而编译系统内核之前,是没有asm这个链接的,所以,在编译过程中,创建该链接时文件名字与asm文件夹的名字发生冲突,报错了。
2.
使用自己编译的内核运行模拟器,结果
提示错误为:
root@lpchou-Lenovo-G450:/android4.4/kernel# emulator -kernel /android4.4/kernel/arch/arm/boot/zImage
emulator: WARNING: system partition size adjusted to match image file (550 MB > 200 MB)
Failed to load libGL.so
error libGL.so: cannot open shared object file: No such file or directory
Failed to load libGL.so
error libGL.so: cannot open shared object file: No such file or directory
我是用的是 make goldfish_armv7_defconfig 命令来编译的啊。
报错解决输入命令:
sudo apt-get install libgl1-mesa-dev
再次运行模拟器,不会报上面的错了,但是模拟器还是黑屏。。。
网上搜索,对于android4.4及以后的版本,使用 goldfish2.6的没用,只有自己去下新的goldfish,于是下载了 goldfish3.4内核。
分享地址:http://pan.baidu.com/s/1kTq2BgN
提取码:4tk3
按照正确的方法在Android4.4上编译 goldfish3.4内核(编译内核还是挺快的),完成后,启动模拟器,如图:
可以看到Android version为 4.4的,而内核为自己编译的3.4.67版本。