On the paper, you may have to learn more about it.
I have been engaged in Android development for more than two years. I used the source code provided on the platform in my company. I finally prepared to thoroughly filter this process one day, I found that this process was not as complicated as I thought. I had a lot of information on the Internet and Google or Baidu when I encountered some problems. But after this process, I felt quite clear.
1. Download source code
The Google website has already provided a detailed introduction. For more information, see
Http://source.android.com/source/downloading.html
For details, install the repo and repo clients and want to talk about your own download skills.
The download was successful only for the third time, and two direct repo syncs were started. However, sometimes it was found that during a certain process, the progress was stopped when more than 20% times, and there was no activity in a day, then, the system breaks down and repo sync again, which won't work for a few days. After the operation, use the multi-thread repo sync-J 64. That's enough. Haha, I downloaded more than 6 GB in one night, broke it once, and re-repo sync again. OK.
Kernel to be downloaded separately: see http://blog.csdn.net/luoshengyang/article/details/6564592
Ii. Compilation
1. Use ubuntu12.04. The default GCC and G ++ values are 4.6. to switch to 4.4, use the following method:
Sudo apt-Get install gcc-4.4 g ++-4.4g ++-4.4-multilib
Sudo mv gcc. Bak
Sudo ln-s gcc-4.4 gcc
Sudo MV g ++. Bak
Sudo ln-s g ++-4.4g ++
Use gcc-V to view the GCC version.
2. Determine the Java version
The compilation should use 1.6, But I have installed 1.6.0.7. Therefore, modify build/CORE/Main. mk and comment out the exit statement when judging the script.
2. Host prebuilt: monkeyrunner (Out/host/linux-x86/obj/executables/monkeyrunner_intermediates/monkeyrunner)
Host C ++: obbtool <= frameworks/base/tools/obbtool/Main. cpp
<Command line>: 0: 0: Error: "_ fortify_source" redefinition [-werror]
<Built-in>: 0: 0: Note: This is the previously defined position.
Cc1plus: All warnings are considered as errors.
Correction:
Modify build/CORE/Combo/HOST_linux-x86.mk 61 lines, Set
Host_global_cflags + =-d_fortify_source = 0
Modify
Host_global_cflags + =-u_fortify_source-d_fortify_source = 0
Android source code for the server, see the specific http://source.android.com/source/downloading.html
4. External/oprofile/libpp/format_output.h: 94: 22: Error: Reference 'counts' cannot be declared 'mutable' [-fpermissive]
Solution:
External/oprofile/libpp/format_output.h
Put:
Mutable counts_t & counts;
Changed:
Counts_t & counts;
5. CTS/apps/ctsverifier/src/COM/Android/CTS/verifier/passfailbuttons. java: 191: Android. app. oncreatedialog (INT, android. OS. bundle) cannot implement COM. android. CTS. verifier. passfailbuttons. oncreatedialog (INT, android. OS. bundle); is trying to specify lower access permissions;
Public
Private Static <t extends Android. App. Activity & passfailactivity>
Solution:
Cd cts;
In Android. mk
# Include CTS/ctstestcoverage. mk
# Include $ (call all-subdir-makefiles)
Comment out.
That is, if you do not compile the CTS module, You need to modify it later, because sometimes you still need to test the CTS.
Finally, mage_intermediates/system. img
Install system FS image: Out/target/product/generic/system. img
Target RAM disk: Out/target/product/generic/ramdisk. img
Target userdata FS image: Out/target/product/generic/userdata. img
Show compilation successful
Add path,
export PATH=$PATH:~/Android/out/host/linux-x86/bin export ANDROID_PRODUCT_OUT=~/Android/out/target/product/generic
Then, run emulator to start the simulator.