Download, configure environment, Build and run reference are all documents provided by Android source, including: Initializing a Build environment,downloading the source and building the System.
I was compiling the AOSP on OSX 10.10.3, documenting the problems that were encountered in the middle.
Download
AOSP need FQ, and often will break, fortunately is a breakpoint continued to pass, insist on a two or three days how can also down.
Case Sensitive System
I will only use Disk utility on my MAC for the file system.
Make error 1
fatal error: linux/netfilter/xt_DSCP.h: No such file or directory
In the directory external/iptables/extensions/: Create file Xt_dscp.h in/include/linux/netfilter.
/** based on ipt_FTOS.c (C) 2000 by Matthew G. Marsh <[email protected]>* This software is distributed under GNU GPL v2, 1991** See RFC2474 for a description of the DSCP field within the IP Header.** xt_DSCP.h,v 1.7 2002/03/14 12:03:13 laforge Exp*/#ifndef _XT_DSCP_TARGET_H#define _XT_DSCP_TARGET_H#include <linux/netfilter/xt_dscp.h>#include <linux/types.h>/* target info */struct xt_DSCP_info { __u8 dscp;};struct xt_tos_target_info { __u8 tos_value; __u8 tos_mask;};#endif /* _XT_DSCP_TARGET_H */
Make error 2
Probably the wrong hint is that jni_generator.py can't find the substring method, Google found that it should be the JDK version of the problem, using jenv to set the JDK version of the Mac to 1.7 can be resolved.
Make error 3
No space left on device
Use Disk utility to increase the size of the DMG.
Emulator 1
Easy to use and need to be added in. Bash_profile:
export PATH=/Volumes/[dmg title]/android/out/host/darwin_x86/bin
It is important to note that OSX 10.10. Version 3 does not generate emulator in the bin directory, you can use path as/VOLUMES/[DMG title]/android/prebuilts/android-emulator/ Darwin-x86x64, You can also copy emulator from this directory to/VOLUMES/[DMG Title]/android/out/host/darwinx86/bin.
Emulator 2
export ANDROID_PRODUCT_OUT=/Volumes/[dmg title]/android/out/target/product/generic
Why export this, please refer to Luo Shenyang's "Android system source code scenario analysis".
Emulator 3
After adding these two export, the following error will be reported:
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
Increase:
export ANDROID_BUILD_TOP=/Volumes/[Volumes]/android
Emulator 4
Finally, the following error is resolved:
emulator: WARNING: system partition size adjusted to match image file (550 MB > 200 MB)emulator: WARNING: data partition size adjusted to match image file (550 MB > 200 MB)
Add parameters when running emulator:
emulator -partition-size 1024
Finally
Finally compile successfully on Mac Aosp, and successfully run emulator, can do further source research.
Reference
- Fatal error:linux/netfilter/xt_dscp.h:no such file or directory
- Jelly Bean (adnroid4.1.1) emulator cannot run directly
- Ubuntu compiled Android 5.0 source small note
Compile and run Android5.0 source code on your Mac