Android 4.04 source code compilation (Ubuntu 12.04)

Source: Internet
Author: User

Original: http://www.adaiw.com /? P = 167

1. Prepare the development environment

Download sun-java6-jdk (not openjdk6)

Ref: http://source.android.com/source/initializing.html

Pay attention to the installation package and connect to libgl:

$ sudo apt-get install git-core gnupg flex bison gperf build-essential \ zip curl libc6-dev libncurses5-dev:i386 x11proto-core-dev \ libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-glx:i386 \ libgl1-mesa-dev g++-multilib mingw32 openjdk-6-jdk tofrodos \ python-markdown libxml2-utils xsltproc zlib1g-dev:i386 
$ sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so

Ubuntu cannot install sun-java6-jdk Solution

If other apt-Get download prompts that the package cannot be found, update: source. List.

If apt-get encounters 407 proxy authentication required, modify/etc/APT/apt. conf.

? View
Code Conf

1234
Acquire::http::proxy "http:///username:passwd@proxy:port/";Acquire::https::proxy "https:///username:passwd@proxy:port/";Acquire::ftp::proxy "ftp:///username:passwd@proxy:port/";Acquire::socks::proxy "socks://username:passwd@proxy:port/";

2. download the latest source code

Http://source.android.com/source/downloading.html

Prepare a hard disk space of more than 13 Gb.

3. Create a repo/git Branch

With the code, the first requirement is to create a git. The repo has provided such a command to help create a git Branch: $ repo start branch project here project refers to many small projects under the source code root, such:

? View
Code Shell

123
$repo start oozicLauncher packages/apps/Launcher2/$cd  packages/apps/Launcher2/$git status

Now you can change the source code with peace of mind. Haha

Ref: http://source.android.com/source/version-control.html

4. Compile source code

Open four threads make: (the number of officially recommended threads is the number of CPUs plus 2)

$ Make-J4

Problems:

Error: prebuilts/tools/GCC-SDK /.. /.. /GCC/linux-x86/host/x86_64-linux-glibc2.7-4.6/bin/x86_64-linux-gcc only run on 64-bit linuxmake: *** [out/host/linux-x86/obj/static_libraries/emulator64-target-arm_intermediates/TCG. o] Error 1 make: *** waiting for unfinished jobs .... The cause is that my Ubuntu is 32-bit and requires 64-bit. Niu Ren gave a solution:
External/qemu/makefile. in common externalqemu/makefile.tar get about-M64 changed to-M32 continue to compile, followed by a problem: Android "error: GNU/stubs-64.h: the reason for no such file or directory is that another cool-man method of the 64-bit system is required to continue compilation. This/out/target/product cannot be compiled. Okay, reload a 64-bit system officially. Select 12.04lts, download ISO, and use pendrive to generate a USB installation disk. Select USB boot for boot. After the installation, Goto Step 15 in ubuntu12.04 compilation problem: Make: *** [out/host/linux-x86/obj/Executables/emulator64-
Arm_intermediates/emulator64-Arm]
Error 1The reason is that ubuntu12.04 is installed with gcc4.6, and the same problem occurs when compiling ICs with gcc4.4. ubuntu11.10. This solution:? View
Code Shell

123
$ sudo apt-get install gcc-4.4 g++-4.4$lunch$make CC=gcc-4.4 CXX=g++-4.4
After the intermediate machine is stuck, press Ctrl + C to stop and re-compile, the compilation is finally completed. Use $ emulator to see the familiar interface reference https://groups.google.com/forum! MSG/Android-building/n5dledtx9py/7iu39xgvigjhttp: // www. android-dev.ro/2011/12/13/building-android-4-0-on-ubuntu-11-10/6 compiled SDK $ make PRODUCT-sdk-sdk7. use this new SDK in eclipse with compiled sdkunzip out/host/linux-86/SDK/android-sdk_eng.herbertdai_linux-x86.zip. A problem occurs: the SDK version is preview and the error message is displayed: You need to add minsdkversion = "aosp" to androidmanifest. xml ". It cannot run on the device either. The version of the device is 4.0.3 or 15, indicating that it is incompatible with aosp. This expert answers: http://www.qkevin.com/archives/257to download the latest source code: platform_version_codename: = aosp is equivalent to a version currently under development, that is, preview, not the official version. In his method, I changed platform_version_codename in build/CORE/version_defaults.mk to: if this is a final release build, it is simply "rel ".
Platform_version_codename: = rel run: $ make cc = gcc-4.4 cxx = g ++-4.4 $ make product-SDK successful. The SDK version is 15 instead of aosp ". Now the program can run normally on the device. PS if you want to modify the @ hide attribute of the field in the source code, run: $ make Update-apigoogle. The first is to close some internal attributes and methods to prevent external programs from being used in disorder, the second is to hide some components under development and remove the @ hide attribute after maturity.
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.