博客:http://blog.csdn.net/muyang_ren
Ubuntu14.04 LTS(要求是64位长期支持版LTS)
Jdk1.8
内核:android4.0
一:jdk
1、解压jdk,获得路径
2、
sudo vim /etc/environment
修改为:
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/home/lhy/jdk/jdk1.8.0_45/bin"
JAVA_HOME="/home/lhy/jdk/jdk1.8.0_45"
CLASSPATH=".:/home/lhy/jdk/jdk1.8.0_45/lib"
3、source /etc/environment
二:ubuntu配置
需要注意jdk的版本和编译器gcc、g++的版本问题,
官网配置:http://source.android.com/source/initializing.html
Ubuntu14.04:
sudo apt-get install bison g++-multilib git gperf libxml2-utils make python-networkx zlib1g-dev:i386 zip
把下面出现错误需要安装的都放在这了
sudo apt-get install g++
sudo apt-get install gcc-multilib
sudo apt-get install g++-4.4-multilib
sudo apt-get install flex
sudo apt-get install libncurses5-dev
sudo apt-get install lib32ncurses5-dev
sudo apt-get install gawk(这个是网上看到需要装的,我就提前安装就没出错了)
出现错误:
下列软件包有未满足的依赖关系:
g++-multilib : 依赖: gcc-multilib (>= 4:4.8.2-1ubuntu6) 但是它将不会被安装
依赖: g++ (>= 4:4.8.2-1ubuntu6) 但是它将不会被安装
E: 无法修正错误,因为您要求某些软件包保持现状,就是它们破坏了软件包间的依赖关系
处理方法:
sudo apt-get install g++
sudo apt-get install gcc-multilib
出现错误:
Checking build tools versions...
************************************************************
You are attempting to build with the incorrect version
of java.
Your version is: java version "1.8.0_45".
The correct version is: Java SE 1.6.
Please follow the machine setup instructions at
http://source.android.com/source/download.html
************************************************************
build/core/main.mk:131: *** stop。 停止。
解决办法,
使用jdk 1.6
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/home/lhy/jdk/jdk1.6.0_29/bin"
JAVA_HOME="/home/lhy/jdk/jdk1.6.0_29"
CLASSPATH=".:/home/lhy/jdk/jdk1.6.0_29/lib"
出现错误:
g++: selected multilib ‘32‘ not installed
make: *** [out/host/linux-x86/obj/EXECUTABLES/aapt_intermediates/aapt] 错误 1
解决办法:
需要安装gcc、g++的multilib包,直接执行下面的命令,会自动安装g++、gcc的multilib包;
sudo apt-get install g++-4.4-multilib
出现错误(这个其实可以忽略):
注意:某些输入文件使用或覆盖了已过时的 API。
注意:要了解详细信息,请使用 -Xlint:deprecation 重新编译。
注意:某些输入文件使用了未经检查或不安全的操作。
注意:要了解详细信息,请使用 -Xlint:unchecked 重新编译。
解决办法(手敲,别tab键,机不好会卡好久):make update-api
出现错误:
/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
出现错误:
host C: adb <= system/core/adb/transport_usb.c
host C: adb <= system/core/adb/commandline.c
host C: adb <= system/core/adb/adb_client.c
host C: adb <= system/core/adb/sockets.c
host C: adb <= system/core/adb/services.c
host C: adb <= system/core/adb/file_sync_client.c
host C: adb <= system/core/adb/get_my_path_linux.c
host C: adb <= system/core/adb/usb_linux.c
host C: adb <= system/core/adb/utils.c
host C: adb <= system/core/adb/usb_vendors.c
host C: adb <= system/core/adb/fdevent.c
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] 错误 1
解决办法:
sudo apt-get install libncurses5-dev
发现错误:
/usr/bin/ld: cannot find -lncurses
collect2: ld returned 1 exit status
make: *** [out/host/linux-x86/obj/EXECUTABLES/adb_intermediates/adb] 错误 1
解决办法:
sudo apt-get install lib32ncurses5-dev
发现错误:
dalvik/vm/native/dalvik_system_Zygote.cpp: In function ‘int setrlimitsFromArray(ArrayObject*)’:
dalvik/vm/native/dalvik_system_Zygote.cpp:194: error: aggregate ‘rlimit rlim’ has incomplete type and cannot be defined
dalvik/vm/native/dalvik_system_Zygote.cpp:217: error: ‘setrlimit’ was not declared in this scope
make: *** [out/host/linux-x86/obj/SHARED_LIBRARIES/libdvm_intermediates/native/dalvik_system_Zygote.o] 错误 1
解决办法:
$ vim dalvik/vm/native/dalvik_system_Zygote.cpp
添加头文件
#include <sys/resource.h>
以下这个可以忽略
注意:某些输入文件使用了未经检查或不安全的操作。
注意:要了解详细信息,请使用 –Xli
版权声明:本文为博主原创文章,未经博主允许不得转载。
原文地址:http://blog.csdn.net/muyang_ren/article/details/46654277