我的操作系统: ubuntu10.10
首先,我们先安装一些常用的工具
curl: sudo apt-get install curl
git: sudo apt-get install git
g++: sudo apt-get install g++
android 源码的下载:
1. mkdir bin 建立bin目录
2. curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo 导入repo执行脚本
3. chmod a+x ~/bin/repo 增加repo的执行权限
4. mkdir workspace 建立自己要存放源码的目录
5. repo init -u https://android.googlesource.com/platform/manifest -b android-4.0.1_r1 初始化项目列表
6. repo sync 下载项目
android 源码的编译和系统建立
1. cd workspace
2. source build/envsetup.sh
3. lunch full-eng
4. make -j4

android make 时可能遇到的问题

/usr/bin/ld: cannot find -lz
host Executable: aapt (out/host/linux-x86/obj/EXECUTABLES/aapt_intermediates/aapt)
/usr/bin/ld: cannot find -lz
collect2: ld returned 1 exit status
make: *** [out/host/linux-x86/obj/EXECUTABLES/aapt_intermediates/aapt] Error 1
解决方法: sudo apt-get install zlib1g-dev sudo apt-get install lib64z1-dev

/bin/bash: bison: command not found
Yacc: aidl <= frameworks/base/tools/aidl/aidl_language_y.y
bison -d -o out/host/linux-x86/obj/EXECUTABLES/aidl_intermediates/aidl_language_y.cpp frameworks/base/tools/aidl/aidl_language_y.y
/bin/bash: bison: command not found
make: *** [out/host/linux-x86/obj/EXECUTABLES/aidl_intermediates/aidl_language_y.cpp] Error 127
解决方法:sudo apt-get install bison

/bin/bash: flex: command not found
out/host/linux-x86/obj/EXECUTABLES/aidl_intermediates/aidl_language_y.cpp: In function ‘int yyparse()’:
out/host/linux-x86/obj/EXECUTABLES/aidl_intermediates/aidl_language_y.cpp:1827: warning: deprecated conversion from string constant to ‘char*’
out/host/linux-x86/obj/EXECUTABLES/aidl_intermediates/aidl_language_y.cpp:1970: warning: deprecated conversion from string constant to ‘char*’
Lex: aidl <= frameworks/base/tools/aidl/aidl_language_l.l
/bin/bash: flex: command not found
make: *** [out/host/linux-x86/obj/EXECUTABLES/aidl_intermediates/aidl_language_l.cpp] Error 127
解决方法: sudo apt-get install flex

/usr/bin/ld: cannot find -lncurses
host Executable: adb (out/host/linux-x86/obj/EXECUTABLES/adb_intermediates/adb)
/usr/bin/ld: cannot find -lncurses
collect2: ld returned 1 exit status
make: *** [out/host/linux-x86/obj/EXECUTABLES/adb_intermediates/adb] Error 1
解决方法:sudo apt-get install libncurses5-dev

fatal error: GL/glx.h: No such file or directory
development/tools/emulator/opengl/host/libs/Translator/GLcommon/GLDispatch.cpp:22: fatal error: GL/glx.h: No such file or directory
compilation terminated.
make: *** [out/host/linux-x86/obj/STATIC_LIBRARIES/libGLcommon_intermediates/GLDispatch.o] Error 1
解决方法:sudo apt-get install libgl1-mesa-dev

sh: gperf: not found
target Generated: libwebcore <= external/webkit/Source/JavaScriptCore/create_regex_tables
Generating CSSPropertyNames.h <= CSSPropertyNames.in
sh: gperf: not found
calling gperf failed: 32512 at ./makeprop.pl line 140.
make: *** [out/target/product/generic/obj/STATIC_LIBRARIES/libwebcore_intermediates/Source/WebCore/css/CSSPropertyNames.h] Error 25
make: *** Deleting file `out/target/product/generic/obj/STATIC_LIBRARIES/libwebcore_intermediates/Source/WebCore/css/CSSPropertyNames.h'
解决方法:sudo apt-get install gperf

更多相关文章

  1. Android 项目生成证书指纹(MD5、SHA1、SHA256)
  2. 使用Android studio导入源码工程
  3. android studio3导入opencv4人脸识别例程安卓项目工程
  4. Android Studio新建项目Rendering Problems警告 处理办法
  5. 新建项目出现android support library问题解决
  6. 笔记:Android Studio发布项目到Bintray
  7. Android Jetpack之Lifecycle的源码分析
  8. Android 源码启动虚拟机经验
  9. Android MediaScannerJNI源码详解

随机推荐

  1. Android(安卓)如何让你的App分享给别人
  2. android应用程序--计算器
  3. Android平台中各类恶意软件及病毒概览
  4. Android(安卓)Banner轮播控件
  5. 一行代码,完成多层视图回退功能( android)(续
  6. Android(安卓)Studio JNI开发-CMake方式
  7. Apk文件结构简介
  8. Android(安卓)studio安装与配置Butter kn
  9. 查看Android设备给每个应用分配的内存大
  10. Android(安卓)短信发送器的实现