码迷,mamicode.com
首页 > 移动开发 > 详细

Mac上编译并运行Android5.0源码

时间:2015-04-26 22:46:43      阅读:653      评论:0      收藏:0      [点我收藏+]

标签:

下载、配置环境、build和运行参考的都是Android Source提供的文档,包括:Initializing a Build EnvironmentDownloading the SourceBuilding the System

我是在OSX 10.10.3上编译的AOSP,记录一下中途碰到的各种问题。

下载

AOSP需要FQ,而且经常会断,还好是断点续传,坚持个两三天怎么也能下下来。

case sensitive system

我在Mac上对file system只会用Disk Utility进行操作。

make error 1

fatal error: linux/netfilter/xt_DSCP.h: No such file or directory

在目录external/iptables/extensions/../include/linux/netfilter中创建文件xt_DSCP.h。

/*
* based on ipt_FTOS.c (C) 2000 by Matthew G. Marsh <mgm@paktronix.com>
* 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

大概错误提示是jni_generator.py找不到substring方法,Google一番发现应该是JDK的版本有问题,使用Jenv将Mac的JDK版本设置为1.7可以解决。

make error 3

No space left on device

使用Disk Utility增加dmg的大小。

emulator 1

方便使用,需要在.bash_profile中增加:

  export PATH=/Volumes/[dmg title]/android/out/host/darwin_x86/bin

需要注意的是OSX 10.10.3版本中bin目录下没有生成emulator,可以将PATH该为/Volumes/[dmg title]/android/prebuilts/android-emulator/darwin-x86x64,也可以将emulator从该目录拷到/Volumes/[dmg title]/android/out/host/darwinx86/bin下。

emulator 2

  export ANDROID_PRODUCT_OUT=/Volumes/[dmg title]/android/out/target/product/generic

为什么export这个,请参考罗升阳的《Android系统源代码情景分析》。

emulator 3

加完这两个export后会报如下错误:

  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

增加:

  export ANDROID_BUILD_TOP=/Volumes/[Volumes]/android

emulator 4

最后解决如下错误:

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)

运行emulator时增加参数:

emulator -partition-size 1024

Finally

最终在Mac上编译成功AOSP,并成功运行emulator,可以做进一步源码研究。

Reference

Mac上编译并运行Android5.0源码

标签:

原文地址:http://www.cnblogs.com/whj198579/p/4458525.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!