How to Compile Android on Ubuntu (12.04)
来源:互联网 发布:英国读高中知乎 编辑:程序博客网 时间:2024/05/17 22:29
http://blog.markloiseau.com/2012/07/how-to-compile-android-on-ubuntu-12-04/
I ran into a few errors when I tried to compile Android on my Ubuntu 12.04 64-bit laptop. Here are my notes on fixing them and compiling successfully:
Wrong Java Version
I have the Java 6 OpenJDK, version 1.6.0_24. This meets the android Java requirement for 1.6.0, but I found (later in the build process) that Android really needs to be built by Sun’s Java SDK. In the meantime, the _24 suffix doesn’t check out in Android’s makefile, which produces the error You are attempting to build with the incorrect version of java before exiting:
Commenting out the $(error stop) statement from build/core/main.mk on line 131 will allow compilation to proceed:
make will display the error message, but continue compiling. However, compiling with OpenJDK will probably create problems later in the build process (in out/target/common/obj/APPS/CtsVerifier_intermediates/classes-full-debug.jar). To fix the problems, Sun’s Java SDK will need to be installed.
Installing the Sun Java 6 JDK in Ubuntu 12.04
To fix the make: *** [out/target/common/obj/APPS/CtsVerifier_intermediates/classes-full-debug.jar] Error 41, get the most recent Sun JDK fromhere. Once you’ve downloaded it, install it and run update-alternatives so your system uses the Sun JDK:
To verify that the installation was successful, check Java’s version. It should now show that the Sun JDK is running instead of IcedTea:
To revert the changes after Android has been compiled, run update-alternatives to switch back to OpenJDK.
error: “_FORTIFY_SOURCE” redefined [-Werror]
This is a well-known error caused by the redefinition of _FORTIFY_SOURCE in build/core/combo/HOST_linux-x86.mk. It doesn’t happen on all systems. In fact, the error didn’t appear for most people in Ubuntu 11.04, but it started showing up after 11.10.
The error can be fixed by changing the HOST_GLOBAL_CFLAGS on line 56 from
to
Undefining and redefining the _FORTIFY_SOURCE macro somehow fixes the issue. The “_FORTIFY_SOURCE redefined” error was initially discovered by aCyanogenMod developer.
external/mesa3d/src/glsl/linker.cpp:1394:49: error: expected primary-expression before ‘,’ token
I was compiling Android with gcc/g++ 4.6. This error can be solved by downgrading to gcc/g++4.4
To reverse the changes when you’re done with them, reverse the instructions:
If your system is like mine, Android should have compiled successfully. You can test the build by running the emulator command, which is automatically added to your path after compilation.
The result:
- How to Compile Android on Ubuntu (12.04)
- How to Compile Android on Ubuntu (12.04)
- How to Compile Android on Ubuntu (12.04)
- How to Compile Android on Ubuntu (12.04)
- How to Compile Android on Ubuntu (12.04)
- How to compile Android 2.3 on Ubuntu 10.04 32bit
- How to compile Android 2.3 on Ubuntu 10.04 32bit
- How to compile Android 2.3 on Ubuntu 10.04 32bit
- How to compile/build QEMU 1.4.0 on Ubuntu 12.04
- How to compile OpenJDK on Ubuntu
- how to compile Objective-C on ubuntu
- How to compile mplayer with vdpau support on Ubuntu
- how to cross compile valgrind on android platform
- How to Run Android Applications on Ubuntu
- How to compile x264 on Windows?
- How to compile x264 on Windows
- How To Compile GLUT on Windows
- how to compile android2.3 on ubuntu14
- 你真想到了50岁还靠编程来养家糊口吗?
- spring中注册bean(通过代码动态注册)
- pcap文件格式分析
- T-sql union
- 别让爱变成一种痛:有点伤感的QQ空间日志
- How to Compile Android on Ubuntu (12.04)
- java 泛型 E/T/K/V/N 代表的意义
- 设置session
- [深入理解C++(一)]类型转换(Type Casting)
- 最长公共子序列
- 呼呼 开始继续android开发啦
- 虽有遗憾,并无后悔——长春天津两站捞票失败小记。
- 显式隐式转换
- uC/OS-II内核架构解析(1)---嵌入式RTOS