MAC下载Android源码

1.运行环境:

    MAC os 10.12.5

2.创建磁盘映像

    鉴于我的MAC机器磁盘空间有限,决定在外置的硬盘上下载源码,创建磁盘映像:

    打开磁盘工具,工具栏选择“文件”-->“新建映像”,设置项如下所示:

    

    我的硬盘是之间在Windows环境下使用的,格式为NTFS格式,先格式化为MAC所识别的格式,选择要操作的磁盘分区-->“抹掉”,在打开的选项中

    

    格式选择:第二项:Mac OS 扩展 (区分大小写、日志式)

    

3.下载repo

    repo是干啥的呢,其实是git的扩展,鉴于源码量大,用git可能存在图形化工具不友好、不支持断点续传等缺点,google官方提供了专用于源码下载的Python脚本,即repo

    创建盛放目录:

        mkdir ~/sourceforandroid

        cd ~/sourceforandroid

        mkdir bin

    PATH=~/sourceforandroid/bin:$PATH

    由于大家都明白的原因,从google官网下载repo会有一些问题,我是从清华大学开源软件镜像站下载的

        注:清华大学开源软件镜像站地址为:https://mirror.tuna.tsinghua.edu.cn/help/AOSP/

    网上有一些资料从该镜像站下载repo使用的git协议,已被关闭,参考:https://mirrors.tuna.tsinghua.edu.cn/help/git-repo/

    下载:

        curl https://mirrors.tuna.tsinghua.edu.cn/git/git-repo -o repo

    赋于运行权限:

        chmod +x repo

4.修改repo文件:

                

    将REPO_URL = ‘https://gerrit.googlesource.com/git-repo’改成 

    REPO_URL = ‘https://gerrit-googlesource.lug.ustc.edu.cn/git-repo’    

5.配置repo下载源码

    首先切至刚刚建立的磁盘映像:

        cd /Volumes/android_source/

    查找当前最新的分支名:https://source.android.com/source/build-numbers#source-code-tags-and-builds

    

    注:从repo中看到的分支要比上述网址上看到的更全面,更新

    repo初始化:repo init -u https://aosp.tuna.tsinghua.edu.cn/android/platform/manifest -b android-8.0.0_r17

    此处有两个注意点:

        a.我自己测的如果repo不在android_source文件夹下,之前设置的repo中的国内镜像地址会失效,因此,我将repo文件copy至android_source文件夹下

        b.还是上面提到的问题,清华镜像不再支持git,要使用https协议

    执行完上述的init之后,执行如下命令,下载源码,所需的时间较长

        repo sync

        

发布了28 篇原创文章 · 获赞 16 · 访问量 2万+
展开阅读全文

Mac编译android 5.0源码报错

12-21

我使用mac编译android源码,踩了无数的坑,但最后有的是在网上找到解决方法了,有的靠自己试出来了,但是今天这个问题我实在是找不到解决方法,求各位大神帮忙解答: 错误信息如下: host C++: validatekeymaps <= frameworks/base/tools/validatekeymaps/Main.cpp host C++: libinput_32 <= frameworks/native/libs/input/Input.cpp host C++: libinput_32 <= frameworks/native/libs/input/InputDevice.cpp host C++: libinput_32 <= frameworks/native/libs/input/Keyboard.cpp <built-in>:0: error: Unknown value ‘10.12’ of -mmacosx-version-min <built-in>:0: error: Unknown value ‘10.12’ of -mmacosx-version-min <built-in>:0: error: Unknown value ‘10.12’ of -mmacosx-version-min <built-in>:0: error: Unknown value ‘10.12’ of -mmacosx-version-min In file included from system/core/include/cutils/log.h:1, from system/core/include/utils/KeyedVector.h:24, from frameworks/native/include/input/Input.h:26, from frameworks/native/include/input/KeyCharacterMap.h:26, from frameworks/base/tools/validatekeymaps/Main.cpp:17: system/core/include/log/log.h:35:20: error: stdarg.h: No such file or directory In file included from system/core/include/cutils/log.h:1, from system/core/include/utils/KeyedVector.h:24, from frameworks/native/include/input/Input.h:26, from frameworks/native/libs/input/Input.cpp:23: system/core/include/log/log.h:35:20: error: stdarg.h: No such file or directory In file included from system/core/include/cutils/log.h:1, from system/core/include/utils/KeyedVector.h:24, from frameworks/native/include/input/Input.h:26, from frameworks/native/include/input/InputDevice.h:20, from frameworks/native/libs/input/InputDevice.cpp:23: system/core/include/log/log.h:35:20: error: stdarg.h: No such file or directory In file included from system/core/include/cutils/log.h:1, from system/core/include/utils/KeyedVector.h:24, from frameworks/native/include/input/Input.h:26, from frameworks/native/include/input/Keyboard.h:20, from frameworks/native/libs/input/Keyboard.cpp:23: system/core/include/log/log.h:35:20: error: stdarg.h: No such file or directory make: *** [out/host/darwin-x86/obj32/EXECUTABLES/validatekeymaps_intermediates/Main.o] Error 1 make: *** Waiting for unfinished jobs.... make: *** [out/host/darwin-x86/obj32/STATIC_LIBRARIES/libinput_intermediates/Input.o] Error 1 make: *** [out/host/darwin-x86/obj32/STATIC_LIBRARIES/libinput_intermediates/InputDevice.o] Error 1 make: *** [out/host/darwin-x86/obj32/STATIC_LIBRARIES/libinput_intermediates/Keyboard.o] Error 1 #### make failed to build some targets (01:01 (mm:ss)) #### 问答

没有更多推荐了,返回首页

©️2019 CSDN 皮肤主题: 大白 设计师: CSDN官方博客

分享到微信朋友圈

×

扫一扫,手机浏览