搭建Ubuntu14.04编译环境并下载源码(二)

Android源码编译环境搭建 专栏收录该内容
11 篇文章 0 订阅

续上搭建Ubuntu14.04编译环境并下载源码(一)

今天临时买了个VPN的帐号,继续下载,翻墙的感觉还是不错的,推荐一下:VPN


使用repo sync时会经常中断,所以有人写了一个脚本,我就直接拿来用了download.sh,需要改下属性chomd a+x download.sh

#!/bin/bash     
    echo "======start repo sync======"     
    repo sync     
    while [ $? == 1 ]; do     
    echo "======sync failed, re-sync again======"     
    sleep 3     
    repo sync     
    done
使用./download.sh 代替repo sync效果更好

终于下载完成了,我下载的是android-4.0.1_r1的源码,大小有4.5G


下面要做的就是编译源码

根据网上找的资料,进入源码目录后第一步要做的就是执行:source build/envsetup.sh

root@ubuntu:/home/dzt/android/WORKING_DIRECTORY# source build/envsetup.sh 
including device/samsung/maguro/vendorsetup.sh
including device/samsung/tuna/vendorsetup.sh
including device/ti/panda/vendorsetup.sh
including sdk/bash_completion/adb.bash
第二步

root@ubuntu:/home/dzt/android/WORKING_DIRECTORY# lunch 4

============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=4.0.1
TARGET_PRODUCT=full_maguro
TARGET_BUILD_VARIANT=userdebug
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=arm
TARGET_ARCH_VARIANT=armv7-a-neon
HOST_ARCH=x86
HOST_OS=linux
HOST_BUILD_TYPE=release
BUILD_ID=ITL41D
============================================
第三步编译源码中的设置程序

<pre name="code" class="plain">root@ubuntu:/home/dzt/android/WORKING_DIRECTORY# mmm packages/apps/Settings/
============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=4.0.1
TARGET_PRODUCT=full_maguro
TARGET_BUILD_VARIANT=userdebug
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=arm
TARGET_ARCH_VARIANT=armv7-a-neon
HOST_ARCH=x86
HOST_OS=linux
HOST_BUILD_TYPE=release
BUILD_ID=ITL41D
============================================
Checking build tools versions...
************************************************************
You are attempting to build with the incorrect version
of java.
 
Your version is: java version "1.8.0_05".
The correct version is: Java SE 1.6.
 
Please follow the machine setup instructions at
    http://source.android.com/source/download.html
************************************************************
make: Entering directory `/home/dzt/android/WORKING_DIRECTORY'
build/core/main.mk:131: *** stop.  Stop.
make: Leaving directory `/home/dzt/android/WORKING_DIRECTORY'

 出错了,提示版本不对,我安装的是1.8,但应用程序的是1.6,只好把1.8换成1.6。
root@ubuntu:/home/dzt# java -version
java version "1.6.0_45"
Java(TM) SE Runtime Environment (build 1.6.0_45-b06)
Java HotSpot(TM) Server VM (build 20.45-b01, mixed mode)
重新编译,还是不行。

root@ubuntu:/home/dzt/android/WORKING_DIRECTORY# mmm packages/apps/Settings/
============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=4.0.1
TARGET_PRODUCT=full_maguro
TARGET_BUILD_VARIANT=userdebug
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=arm
TARGET_ARCH_VARIANT=armv7-a-neon
HOST_ARCH=x86
HOST_OS=linux
HOST_BUILD_TYPE=release
BUILD_ID=ITL41D
============================================
Checking build tools versions...
No private recovery resources for TARGET_DEVICE maguro
make: Entering directory `/home/dzt/android/WORKING_DIRECTORY'
make: *** No rule to make target `out/host/linux-x86/bin/aapt', needed by `out/target/common/obj/APPS/Settings_intermediates/src/R.stamp'.  Stop.
make: Leaving directory `/home/dzt/android/WORKING_DIRECTORY'
解决方案:

进入源码目录,执行make -j2(cpu的核数,如果是4核就2乘4)单核就是-j2:

root@ubuntu:/home/dzt/android/WORKING_DIRECTORY# make -j2
============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=4.0.1
TARGET_PRODUCT=full
TARGET_BUILD_VARIANT=eng
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=arm
TARGET_ARCH_VARIANT=armv7-a
HOST_ARCH=x86
HOST_OS=linux
HOST_BUILD_TYPE=release
BUILD_ID=ITL41D
============================================
host Java: jsr305lib (out/host/common/obj/JAVA_LIBRARIES/jsr305lib_intermediates/classes)
Header: out/host/linux-x86/obj/include/libexpat/expat.h
Header: out/host/linux-x86/obj/include/libexpat/expat_external.h
Header: out/target/product/generic/obj/include/libexpat/expat.h
Header: out/target/product/generic/obj/include/libexpat/expat_external.h
Header: out/host/linux-x86/obj/include/libpng/png.h
Header: out/host/linux-x86/obj/include/libpng/pngconf.h
Header: out/host/linux-x86/obj/include/libpng/pngusr.h
Header: out/target/product/generic/obj/include/libpng/png.h
Header: out/target/product/generic/obj/include/libpng/pngconf.h
Header: out/target/product/generic/obj/include/libpng/pngusr.h
Header: out/target/product/generic/obj/include/libsonivox/eas.h
Header: out/target/product/generic/obj/include/libsonivox/eas_types.h
Header: out/target/product/generic/obj/include/libsonivox/eas_reverb.h
Header: out/target/product/generic/obj/include/libsonivox/jet.h
Header: out/target/product/generic/obj/include/libsonivox/ARM_synth_constants_gnu.inc
Header: out/target/product/generic/obj/include/libwpa_client/wpa_ctrl.h
Notice file: external/guava/NOTICE -- out/host/linux-x86/obj/NOTICE_FILES/src//framework/guavalib.jar.txt
host Java: antlr (out/host/common/obj/JAVA_LIBRARIES/antlr_intermediates/classes)
Notice file: external/doclava/NOTICE -- out/host/linux-x86/obj/NOTICE_FILES/src//framework/doclava.jar.txt
target Java: core (out/target/common/obj/JAVA_LIBRARIES/core_intermediates/classes)
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
host Java: dx (out/host/common/obj/JAVA_LIBRARIES/dx_intermediates/classes)
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Notice file: dalvik/dx/NOTICE -- out/host/linux-x86/obj/NOTICE_FILES/src//bin/dx.txt
Notice file: frameworks/base/tools/aapt/NOTICE -- out/host/linux-x86/obj/NOTICE_FILES/src//bin/aapt.txt
Notice file: frameworks/base/libs/utils/NOTICE -- out/host/linux-x86/obj/NOTICE_FILES/src//lib/libutils.a.txt
Notice file: system/core/liblog/NOTICE -- out/host/linux-x86/obj/NOTICE_FILES/src//lib/liblog.a.txt
Notice file: system/core/libcutils/NOTICE -- out/host/linux-x86/obj/NOTICE_FILES/src//lib/libcutils.a.txt
Notice file: external/expat/NOTICE -- out/host/linux-x86/obj/NOTICE_FILES/src//lib/libexpat.a.txt
Notice file: external/libpng/NOTICE -- out/host/linux-x86/obj/NOTICE_FILES/src//lib/libpng.a.txt
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
touch out/host/linux-x86/obj/EXECUTABLES/aidl_intermediates/aidl_language_y.hpp
echo '#ifndef 'aidl_language_y_h > out/host/linux-x86/obj/EXECUTABLES/aidl_intermediates/aidl_language_y.h
echo '#define 'aidl_language_y_h >> out/host/linux-x86/obj/EXECUTABLES/aidl_intermediates/aidl_language_y.h
cat out/host/linux-x86/obj/EXECUTABLES/aidl_intermediates/aidl_language_y.hpp >> out/host/linux-x86/obj/EXECUTABLES/aidl_intermediates/aidl_language_y.h
echo '#endif' >> out/host/linux-x86/obj/EXECUTABLES/aidl_intermediates/aidl_language_y.h
rm -f out/host/linux-x86/obj/EXECUTABLES/aidl_intermediates/aidl_language_y.hpp
Lex: aidl <= frameworks/base/tools/aidl/aidl_language_l.l
frameworks/base/tools/aidl/aidl_language_l.l:54: warning, rule cannot be matched
Notice file: frameworks/base/tools/aidl/NOTICE -- out/host/linux-x86/obj/NOTICE_FILES/src//bin/aidl.txt
Notice file: external/tinyxml/NOTICE -- out/host/linux-x86/obj/NOTICE_FILES/src//lib/libtinyxml.a.txt
prebuilt/linux-x86/toolchain/arm-linux-androideabi-4.4.x/bin/arm-linux-androideabi-gcc -mthumb-interwork -Ibionic/libc/private -DCRT_LEGACY_WORKAROUND -Ibionic/libc/private -o out/target/product/generic/obj/lib/crtbegin_so.o -c bionic/libc/arch-arm/bionic/crtbegin_so.S
prebuilt/linux-x86/toolchain/arm-linux-androideabi-4.4.x/bin/arm-linux-androideabi-gcc -mthumb-interwork -Ibionic/libc/private -DCRT_LEGACY_WORKAROUND -Ibionic/libc/private -o out/target/product/generic/obj/lib/crtend_so.o -c bionic/libc/arch-arm/bionic/crtend_so.S
Notice file: bionic/libc/NOTICE -- out/target/product/generic/obj/NOTICE_FILES/src//system/lib/libc.so.txt
Notice file: bionic/libc/NOTICE -- out/target/product/generic/obj/NOTICE_FILES/src//system/lib/libc_common.a.txt
Notice file: bionic/libdl/NOTICE -- out/target/product/generic/obj/NOTICE_FILES/src//system/lib/libdl.so.txt
Notice file: bionic/libstdc++/NOTICE -- out/target/product/generic/obj/NOTICE_FILES/src//system/lib/libstdc++.so.txt
Notice file: bionic/libm/NOTICE -- out/target/product/generic/obj/NOTICE_FILES/src//system/lib/libm.so.txt
Notice file: system/core/liblog/NOTICE -- out/target/product/generic/obj/NOTICE_FILES/src//system/lib/liblog.so.txt
Notice file: system/core/liblog/NOTICE -- out/target/product/generic/obj/NOTICE_FILES/src//system/lib/liblog.a.txt
Notice file: system/core/libcutils/NOTICE -- out/target/product/generic/obj/NOTICE_FILES/src//system/lib/libcutils.so.txt
Notice file: system/core/libcutils/NOTICE -- out/target/product/generic/obj/NOTICE_FILES/src//system/lib/libcutils.a.txt
Notice file: frameworks/base/media/libmedia/NOTICE -- out/target/product/generic/obj/NOTICE_FILES/src//system/lib/libmedia.so.txt
Notice file: frameworks/base/libs/ui/NOTICE -- out/target/product/generic/obj/NOTICE_FILES/src//system/lib/libui.so.txt
Notice file: frameworks/base/libs/utils/NOTICE -- out/target/product/generic/obj/NOTICE_FILES/src//system/lib/libutils.so.txt
Notice file: external/zlib/NOTICE -- out/target/product/generic/obj/NOTICE_FILES/src//system/lib/libz.so.txt
Notice file: external/liblzf/NOTICE -- out/target/product/generic/obj/NOTICE_FILES/src//system/lib/liblzf.a.txt
Notice file: system/core/libpixelflinger/NOTICE -- out/target/product/generic/obj/NOTICE_FILES/src//system/lib/libpixelflinger.so.txt
Notice file: hardware/libhardware_legacy/NOTICE -- out/target/product/generic/obj/NOTICE_FILES/src//system/lib/libhardware_legacy.so.txt
Notice file: external/wpa_supplicant/NOTICE -- out/target/product/generic/obj/NOTICE_FILES/src//system/lib/libwpa_client.so.txt
Notice file: system/core/libnetutils/NOTICE -- out/target/product/generic/obj/NOTICE_FILES/src//system/lib/libnetutils.so.txt
Notice file: hardware/libhardware/NOTICE -- out/target/product/generic/obj/NOTICE_FILES/src//system/lib/libhardware.so.txt
Notice file: external/skia/NOTICE -- out/target/product/generic/obj/NOTICE_FILES/src//system/lib/libskia.so.txt
Notice file: external/freetype/NOTICE -- out/target/product/generic/obj/NOTICE_FILES/src//system/lib/libft2.a.txt
Notice file: external/libpng/NOTICE -- out/target/product/generic/obj/NOTICE_FILES/src//system/lib/libpng.a.txt
Notice file: external/giflib/NOTICE -- out/target/product/generic/obj/NOTICE_FILES/src//system/lib/libgif.a.txt
Notice file: external/jpeg/NOTICE -- out/target/product/generic/obj/NOTICE_FILES/src//system/lib/libjpeg.so.txt
Notice file: external/expat/NOTICE -- out/target/product/generic/obj/NOTICE_FILES/src//system/lib/libexpat.so.txt
Notice file: external/sonivox/arm-wt-22k/NOTICE -- out/target/product/generic/obj/NOTICE_FILES/src//system/lib/libsonivox.so.txt
Notice file: external/icu4c/common/NOTICE -- out/target/product/generic/obj/NOTICE_FILES/src//system/lib/libicuuc.so.txt
Notice file: external/icu4c/common/NOTICE -- out/host/linux-x86/obj/NOTICE_FILES/src//lib/libicuuc.so.txt
Notice file: system/core/libzipfile/NOTICE -- out/host/linux-x86/obj/NOTICE_FILES/src//lib/libzipfile.a.txt
Notice file: external/zlib/NOTICE -- out/host/linux-x86/obj/NOTICE_FILES/src//lib/libunz.a.txt
Directory: out/target/product/generic/root/sbin
Directory: out/target/product/generic/root/dev
Directory: out/target/product/generic/root/proc
Directory: out/target/product/generic/root/sys
Directory: out/target/product/generic/root/system
Directory: out/target/product/generic/root/data
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Directory: out/target/product/generic/data
Notice file: system/core/adb/NOTICE -- out/host/linux-x86/obj/NOTICE_FILES/src//bin/adb.txt
host Java: apkcheck (out/host/common/obj/JAVA_LIBRARIES/apkcheck_intermediates/classes)

//中间部分打印省略

Can't locate Switch.pm in @INC (you may need to install the Switch module) (@INC contains: /etc/perl /usr/local/lib/perl/5.18.2 /usr/local/share/perl/5.18.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.18 /usr/share/perl/5.18 /usr/local/lib/site_perl .) at external/webkit/Source/WebCore/make-hash-tools.pl line 23.
BEGIN failed--compilation aborted at external/webkit/Source/WebCore/make-hash-tools.pl line 23.
make: *** [out/target/product/generic/obj/STATIC_LIBRARIES/libwebcore_intermediates/Source/WebCore/html/DocTypeStrings.cpp] Error 2
make: *** Waiting for unfinished jobs....
解决办法:出现了两个错误,解决办法,安装:libswitch-perl
root@ubuntu:/home/dzt/android/WORKING_DIRECTORY# sudo apt-get install libswitch-perl
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
  libswitch-perl
0 upgraded, 1 newly installed, 0 to remove and 272 not upgraded.
Need to get 19.2 kB of archives.
After this operation, 75.8 kB of additional disk space will be used.
Get:1 http://us.archive.ubuntu.com/ubuntu/ trusty/universe libswitch-perl all 2.16-2 [19.2 kB]
Fetched 19.2 kB in 4s (3,940 B/s)                      
Selecting previously unselected package libswitch-perl.
(Reading database ... 178888 files and directories currently installed.)
Preparing to unpack .../libswitch-perl_2.16-2_all.deb ...
Unpacking libswitch-perl (2.16-2) ...
Processing triggers for man-db (2.6.7.1-1) ...
Setting up libswitch-perl (2.16-2) ...
还是报错了
root@ubuntu:/home/dzt/android/WORKING_DIRECTORY# make -j2
============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=4.0.1
TARGET_PRODUCT=full
TARGET_BUILD_VARIANT=eng
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=arm
TARGET_ARCH_VARIANT=armv7-a
HOST_ARCH=x86
HOST_OS=linux
HOST_BUILD_TYPE=release
BUILD_ID=ITL41D
============================================
host C: acp <= build/tools/acp/acp.c
host C++: libhost <= build/libs/host/pseudolocalize.cpp
<command-line>:0:0: warning: "_FORTIFY_SOURCE" redefined [enabled by default]
build/tools/acp/acp.c:1:0: note: this is the location of the previous definition
 /*
 ^
<command-line>:0:0: warning: "_FORTIFY_SOURCE" redefined [enabled by default]
build/libs/host/pseudolocalize.cpp:1:0: note: this is the location of the previous definition
 #include <host/pseudolocalize.h>
 ^
host C: libhost <= build/libs/host/CopyFile.c
host C++: aapt <= frameworks/base/tools/aapt/AaptAssets.cpp
<command-line>:0:0: warning: "_FORTIFY_SOURCE" redefined [enabled by default]
build/libs/host/CopyFile.c:1:0: note: this is the location of the previous definition
 /*
 ^
build/libs/host/CopyFile.c: In function ‘isSameFile’:
build/libs/host/CopyFile.c:87:43: warning: unused parameter ‘pSrcStat’ [-Wunused-parameter]
 static bool isSameFile(const struct stat* pSrcStat, const struct stat* pDstStat)
                                           ^
build/libs/host/CopyFile.c:87:72: warning: unused parameter ‘pDstStat’ [-Wunused-parameter]
 static bool isSameFile(const struct stat* pSrcStat, const struct stat* pDstStat)
                                                                        ^
build/libs/host/CopyFile.c: In function ‘printNotNewerMsg’:
build/libs/host/CopyFile.c:105:42: warning: unused parameter ‘src’ [-Wunused-parameter]
 static void printNotNewerMsg(const char* src, const char* dst, unsigned int options)
                                          ^
build/libs/host/CopyFile.c: In function ‘copyFileRecursive’:
build/libs/host/CopyFile.c:530:69: warning: unused parameter ‘isCmdLine’ [-Wunused-parameter]
 static int copyFileRecursive(const char* src, const char* dst, bool isCmdLine, unsigned int options)
                                                                     ^
<command-line>:0:0: warning: "_FORTIFY_SOURCE" redefined [enabled by default]
frameworks/base/tools/aapt/AaptAssets.cpp:1:0: note: this is the location of the previous definition
 //
 ^
host C++: aapt <= frameworks/base/tools/aapt/Command.cpp
<command-line>:0:0: warning: "_FORTIFY_SOURCE" redefined [enabled by default]
frameworks/base/tools/aapt/Command.cpp:1:0: note: this is the location of the previous definition
 //
 ^
frameworks/base/tools/aapt/AaptAssets.cpp:2161:1: warning: unused parameter ‘bundle’ [-Wunused-parameter]
 AaptAssets::slurpResourceZip(Bundle* bundle, const char* filename)
 ^
In file included from frameworks/base/include/utils/AssetManager.h:25:0,
                 from frameworks/base/tools/aapt/AaptAssets.h:10,
                 from frameworks/base/tools/aapt/AaptAssets.cpp:5:
frameworks/base/include/utils/KeyedVector.h: In instantiation of ‘const VALUE& android::DefaultKeyedVector<KEY, VALUE>::valueFor(const KEY&) const [with KEY = android::String8; VALUE = android::sp<AaptSymbols>]’:
frameworks/base/tools/aapt/AaptAssets.h:446:59:   required from here
frameworks/base/include/utils/KeyedVector.h:193:31: error: ‘indexOfKey’ was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
     ssize_t i = indexOfKey(key);
                               ^
frameworks/base/include/utils/KeyedVector.h:193:31: note: declarations in dependent base ‘android::KeyedVector<android::String8, android::sp<AaptSymbols> >’ are not found by unqualified lookup
frameworks/base/include/utils/KeyedVector.h:193:31: note: use ‘this->indexOfKey’ instead
frameworks/base/include/utils/KeyedVector.h: In instantiation of ‘const VALUE& android::DefaultKeyedVector<KEY, VALUE>::valueFor(const KEY&) const [with KEY = android::String8; VALUE = android::sp<AaptGroup>]’:
frameworks/base/tools/aapt/AaptAssets.cpp:1636:41:   required from here
frameworks/base/include/utils/KeyedVector.h:193:31: error: ‘indexOfKey’ was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
frameworks/base/include/utils/KeyedVector.h:193:31: note: declarations in dependent base ‘android::KeyedVector<android::String8, android::sp<AaptGroup> >’ are not found by unqualified lookup
frameworks/base/include/utils/KeyedVector.h:193:31: note: use ‘this->indexOfKey’ instead
frameworks/base/include/utils/KeyedVector.h: In instantiation of ‘const VALUE& android::DefaultKeyedVector<KEY, VALUE>::valueFor(const KEY&) const [with KEY = android::String8; VALUE = android::sp<AaptDir>]’:
frameworks/base/tools/aapt/AaptAssets.cpp:1700:53:   required from here
frameworks/base/include/utils/KeyedVector.h:193:31: error: ‘indexOfKey’ was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
frameworks/base/include/utils/KeyedVector.h:193:31: note: declarations in dependent base ‘android::KeyedVector<android::String8, android::sp<AaptDir> >’ are not found by unqualified lookup
frameworks/base/include/utils/KeyedVector.h:193:31: note: use ‘this->indexOfKey’ instead
make: *** [out/host/linux-x86/obj/EXECUTABLES/aapt_intermediates/AaptAssets.o] Error 1
make: *** Waiting for unfinished jobs....
In file included from frameworks/base/include/utils/AssetManager.h:25:0,
                 from frameworks/base/tools/aapt/AaptAssets.h:10,
                 from frameworks/base/tools/aapt/Main.h:14,
                 from frameworks/base/tools/aapt/Command.cpp:6:
frameworks/base/include/utils/KeyedVector.h: In instantiation of ‘const VALUE& android::DefaultKeyedVector<KEY, VALUE>::valueFor(const KEY&) const [with KEY = android::String8; VALUE = android::sp<AaptSymbols>]’:
frameworks/base/tools/aapt/AaptAssets.h:446:59:   required from here
frameworks/base/include/utils/KeyedVector.h:193:31: error: ‘indexOfKey’ was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
     ssize_t i = indexOfKey(key);
                               ^
frameworks/base/include/utils/KeyedVector.h:193:31: note: declarations in dependent base ‘android::KeyedVector<android::String8, android::sp<AaptSymbols> >’ are not found by unqualified lookup
frameworks/base/include/utils/KeyedVector.h:193:31: note: use ‘this->indexOfKey’ instead
frameworks/base/include/utils/KeyedVector.h: In instantiation of ‘const VALUE& android::DefaultKeyedVector<KEY, VALUE>::valueFor(const KEY&) const [with KEY = android::String16; VALUE = unsigned int]’:
frameworks/base/tools/aapt/ResourceTable.h:485:100:   required from here
frameworks/base/include/utils/KeyedVector.h:193:31: error: ‘indexOfKey’ was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
frameworks/base/include/utils/KeyedVector.h:193:31: note: declarations in dependent base ‘android::KeyedVector<android::String16, unsigned int>’ are not found by unqualified lookup
frameworks/base/include/utils/KeyedVector.h:193:31: note: use ‘this->indexOfKey’ instead
make: *** [out/host/linux-x86/obj/EXECUTABLES/aapt_intermediates/Command.o] Error 1
网上找到的解决办法:
问题一:
error: ‘indexOfKey’ was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]

Fix:
vi frameworks/base/libs/utils/Android.mk

Add '-fpermissive' to line 64:

LOCAL_CFLAGS += -DLIBUTILS_NATIVE=1 $(TOOL_CFLAGS) -fpermissive



问题二:
frameworks/base/include/utils/KeyedVector.h:193:31: note: declarations in dependent base ‘android::KeyedVector<android::String8, android::sp<AaptDir> >’ are not found by unqualified lookup

frameworks/base/include/utils/KeyedVector.h:193:31: note: use ‘this->indexOfKey’ instead
make: *** [ out/host/linux-x86/obj/EXECUTABLES/aapt_intermediates/AaptAssets.o] Error 1

Fix:
vi frameworks/base/tools/aapt/Android.mk

Add '-fpermissive' to line 31:
LOCAL_CFLAGS += -Wno-format-y2k -fpermissive

使用命令make -j2还是报错了

external/srec/tools/thirdparty/OpenFst/fst/lib/factor-weight.h:288:40: note: declarations in dependent base ‘fst::CacheBaseImpl<fst::CacheState<fst::GallicArc<fst::StdArc, (fst::StringType)0u> > >’ are not found by unqualified lookup
external/srec/tools/thirdparty/OpenFst/fst/lib/factor-weight.h:288:40: note: use ‘this->AddArc’ instead
external/srec/tools/thirdparty/OpenFst/fst/lib/factor-weight.h:291:14: error: ‘SetArcs’ was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
     SetArcs(s);
              ^
external/srec/tools/thirdparty/OpenFst/fst/lib/factor-weight.h:291:14: note: declarations in dependent base ‘fst::CacheBaseImpl<fst::CacheState<fst::GallicArc<fst::StdArc, (fst::StringType)0u> > >’ are not found by unqualified lookup
external/srec/tools/thirdparty/OpenFst/fst/lib/factor-weight.h:291:14: note: use ‘this->SetArcs’ instead
In file included from external/srec/tools/thirdparty/OpenFst/fst/lib/arc.h:24:0,
                 from external/srec/tools/thirdparty/OpenFst/fst/lib/fst.h:23,
                 from external/srec/tools/grxmlcompile/grxmlcompile.cpp:24:
external/srec/tools/thirdparty/OpenFst/fst/lib/string-weight.h: In instantiation of ‘fst::StringWeight<L, S> fst::StringWeight<L, S>::Quantize(float) const [with L = int; fst::StringType S = (fst::StringType)2u]’:
external/srec/tools/thirdparty/OpenFst/fst/lib/product-weight.h:81:72:   required from ‘fst::ProductWeight<W1, W2> fst::ProductWeight<W1, W2>::Quantize(float) const [with W1 = fst::StringWeight<int, (fst::StringType)2u>; W2 = fst::TropicalWeight]’
external/srec/tools/thirdparty/OpenFst/fst/lib/determinize.h:366:27:   required from ‘void fst::DeterminizeFsaImpl<A, C>::AddArc(fst::DeterminizeFsaImpl<A, C>::StateId, fst::DeterminizeFsaImpl<A, C>::Label, fst::DeterminizeFsaImpl<A, C>::Subset*) [with A = fst::GallicArc<fst::StdArc, (fst::StringType)2u>; C = fst::GallicCommonDivisor<int, fst::TropicalWeight, (fst::StringType)2u, fst::DefaultCommonDivisor<fst::TropicalWeight> >; fst::DeterminizeFsaImpl<A, C>::StateId = int; fst::DeterminizeFsaImpl<A, C>::Label = int; fst::DeterminizeFsaImpl<A, C>::Subset = __gnu_cxx::slist<fst::DeterminizeFsaImpl<fst::GallicArc<fst::StdArc, (fst::StringType)2u>, fst::GallicCommonDivisor<int, fst::TropicalWeight, (fst::StringType)2u, fst::DefaultCommonDivisor<fst::TropicalWeight> > >::Element, std::allocator<fst::DeterminizeFsaImpl<fst::GallicArc<fst::StdArc, (fst::StringType)2u>, fst::GallicCommonDivisor<int, fst::TropicalWeight, (fst::StringType)2u, fst::DefaultCommonDivisor<fst::TropicalWeight> > >::Element> >]’
external/srec/tools/thirdparty/OpenFst/fst/lib/determinize.h:296:44:   required from ‘void fst::DeterminizeFsaImpl<A, C>::Expand(fst::DeterminizeFsaImpl<A, C>::StateId) [with A = fst::GallicArc<fst::StdArc, (fst::StringType)2u>; C = fst::GallicCommonDivisor<int, fst::TropicalWeight, (fst::StringType)2u, fst::DefaultCommonDivisor<fst::TropicalWeight> >; fst::DeterminizeFsaImpl<A, C>::StateId = int]’
external/srec/tools/grxmlcompile/grxmlcompile.cpp:938:1:   required from here
external/srec/tools/thirdparty/OpenFst/fst/lib/string-weight.h:110:22: warning: unused parameter ‘delta’ [-Wunused-parameter]
   StringWeight<L, S> Quantize(float delta = kDelta) const {
                      ^
In file included from external/srec/tools/thirdparty/OpenFst/fst/lib/arcsort.h:24:0,
                 from external/srec/tools/thirdparty/OpenFst/fst/lib/fstlib.h:54,
                 from external/srec/tools/grxmlcompile/grxmlcompile.cpp:25:
external/srec/tools/thirdparty/OpenFst/fst/lib/cache.h: In instantiation of ‘S* fst::CacheBaseImpl<S>::ExtendState(fst::CacheBaseImpl<S>::StateId) [with S = fst::CacheState<fst::GallicArc<fst::StdArc, (fst::StringType)0u> >; fst::CacheBaseImpl<S>::StateId = int]’:
external/srec/tools/thirdparty/OpenFst/fst/lib/cache.h:165:29:   required from ‘void fst::CacheBaseImpl<S>::SetFinal(fst::CacheBaseImpl<S>::StateId, fst::CacheBaseImpl<S>::Weight) [with S = fst::CacheState<fst::GallicArc<fst::StdArc, (fst::StringType)0u> >; fst::CacheBaseImpl<S>::StateId = int; fst::CacheBaseImpl<S>::Weight = fst::GallicWeight<int, fst::TropicalWeight, (fst::StringType)0u>]’
external/srec/tools/thirdparty/OpenFst/fst/lib/factor-weight.h:197:22:   required from ‘fst::FactorWeightFstImpl<A, F>::Weight fst::FactorWeightFstImpl<A, F>::Final(fst::FactorWeightFstImpl<A, F>::StateId) [with A = fst::GallicArc<fst::StdArc, (fst::StringType)0u>; F = fst::GallicFactor<int, fst::TropicalWeight, (fst::StringType)0u>; fst::FactorWeightFstImpl<A, F>::Weight = fst::GallicWeight<int, fst::TropicalWeight, (fst::StringType)0u>; fst::FactorWeightFstImpl<A, F>::StateId = int]’
external/srec/tools/thirdparty/OpenFst/fst/lib/factor-weight.h:362:64:   required from ‘fst::FactorWeightFst<A, F>::Weight fst::FactorWeightFst<A, F>::Final(fst::FactorWeightFst<A, F>::StateId) const [with A = fst::GallicArc<fst::StdArc, (fst::StringType)0u>; F = fst::GallicFactor<int, fst::TropicalWeight, (fst::StringType)0u>; fst::FactorWeightFst<A, F>::Weight = fst::GallicWeight<int, fst::TropicalWeight, (fst::StringType)0u>; fst::FactorWeightFst<A, F>::StateId = int]’
external/srec/tools/grxmlcompile/grxmlcompile.cpp:938:1:   required from here
external/srec/tools/thirdparty/OpenFst/fst/lib/cache.h:132:26: error: ‘SetState’ was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
         SetState(s, new S);
                          ^
external/srec/tools/thirdparty/OpenFst/fst/lib/cache.h:132:26: note: declarations in dependent base ‘fst::VectorFstBaseImpl<fst::CacheState<fst::GallicArc<fst::StdArc, (fst::StringType)0u> > >’ are not found by unqualified lookup
external/srec/tools/thirdparty/OpenFst/fst/lib/cache.h:132:26: note: use ‘this->SetState’ instead
external/srec/tools/thirdparty/OpenFst/fst/lib/cache.h:136:61: error: ‘SetState’ was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
           SetState(cache_first_state_id_, cache_first_state_);
                                                             ^
external/srec/tools/thirdparty/OpenFst/fst/lib/cache.h:136:61: note: declarations in dependent base ‘fst::VectorFstBaseImpl<fst::CacheState<fst::GallicArc<fst::StdArc, (fst::StringType)0u> > >’ are not found by unqualified lookup
external/srec/tools/thirdparty/OpenFst/fst/lib/cache.h:136:61: note: use ‘this->SetState’ instead
In file included from external/srec/tools/thirdparty/OpenFst/fst/lib/dfs-visit.h:24:0,
                 from external/srec/tools/thirdparty/OpenFst/fst/lib/test-properties.h:27,
                 from external/srec/tools/thirdparty/OpenFst/fst/lib/vector-fst.h:27,
                 from external/srec/tools/thirdparty/OpenFst/fst/lib/fstlib.h:50,
                 from external/srec/tools/grxmlcompile/grxmlcompile.cpp:25:
external/srec/tools/thirdparty/OpenFst/fst/lib/arcfilter.h: In instantiation of ‘bool fst::AnyArcFilter<A>::operator()(const A&) const [with A = fst::GallicArc<fst::StdArc, (fst::StringType)2u>]’:
external/srec/tools/thirdparty/OpenFst/fst/lib/dfs-visit.h:124:22:   required from ‘void fst::DfsVisit(const fst::Fst<A>&, V*, ArcFilter) [with Arc = fst::GallicArc<fst::StdArc, (fst::StringType)2u>; V = fst::SccVisitor<fst::GallicArc<fst::StdArc, (fst::StringType)2u> >; ArcFilter = fst::AnyArcFilter<fst::GallicArc<fst::StdArc, (fst::StringType)2u> >]’
external/srec/tools/thirdparty/OpenFst/fst/lib/dfs-visit.h:159:45:   required from ‘void fst::DfsVisit(const fst::Fst<A>&, V*) [with Arc = fst::GallicArc<fst::StdArc, (fst::StringType)2u>; V = fst::SccVisitor<fst::GallicArc<fst::StdArc, (fst::StringType)2u> >]’
external/srec/tools/thirdparty/OpenFst/fst/lib/test-properties.h:105:31:   required from ‘uint64 fst::ComputeProperties(const fst::Fst<A>&, uint64, uint64*, bool) [with Arc = fst::GallicArc<fst::StdArc, (fst::StringType)2u>; uint64 = long long unsigned int]’
external/srec/tools/thirdparty/OpenFst/fst/lib/test-properties.h:232:70:   required from ‘uint64 fst::TestProperties(const fst::Fst<A>&, uint64, uint64*) [with Arc = fst::GallicArc<fst::StdArc, (fst::StringType)2u>; uint64 = long long unsigned int]’
external/srec/tools/thirdparty/OpenFst/fst/lib/factor-weight.h:376:62:   required from ‘uint64 fst::FactorWeightFst<A, F>::Properties(uint64, bool) const [with A = fst::GallicArc<fst::StdArc, (fst::StringType)2u>; F = fst::GallicFactor<int, fst::TropicalWeight, (fst::StringType)2u>; uint64 = long long unsigned int]’
external/srec/tools/grxmlcompile/grxmlcompile.cpp:938:1:   required from here
external/srec/tools/thirdparty/OpenFst/fst/lib/arcfilter.h:28:8: warning: unused parameter ‘arc’ [-Wunused-parameter]
   bool operator()(const A &arc) const { return true; }
        ^
In file included from external/srec/tools/thirdparty/OpenFst/fst/lib/test-properties.h:26:0,
                 from external/srec/tools/thirdparty/OpenFst/fst/lib/vector-fst.h:27,
                 from external/srec/tools/thirdparty/OpenFst/fst/lib/fstlib.h:50,
                 from external/srec/tools/grxmlcompile/grxmlcompile.cpp:25:
external/srec/tools/thirdparty/OpenFst/fst/lib/connect.h: In instantiation of ‘bool fst::SccVisitor<A>::TreeArc(fst::SccVisitor<A>::StateId, const A&) [with A = fst::GallicArc<fst::StdArc, (fst::StringType)2u>; fst::SccVisitor<A>::StateId = int]’:
external/srec/tools/thirdparty/OpenFst/fst/lib/dfs-visit.h:132:15:   required from ‘void fst::DfsVisit(const fst::Fst<A>&, V*, ArcFilter) [with Arc = fst::GallicArc<fst::StdArc, (fst::StringType)2u>; V = fst::SccVisitor<fst::GallicArc<fst::StdArc, (fst::StringType)2u> >; ArcFilter = fst::AnyArcFilter<fst::GallicArc<fst::StdArc, (fst::StringType)2u> >]’
external/srec/tools/thirdparty/OpenFst/fst/lib/dfs-visit.h:159:45:   required from ‘void fst::DfsVisit(const fst::Fst<A>&, V*) [with Arc = fst::GallicArc<fst::StdArc, (fst::StringType)2u>; V = fst::SccVisitor<fst::GallicArc<fst::StdArc, (fst::StringType)2u> >]’
external/srec/tools/thirdparty/OpenFst/fst/lib/test-properties.h:105:31:   required from ‘uint64 fst::ComputeProperties(const fst::Fst<A>&, uint64, uint64*, bool) [with Arc = fst::GallicArc<fst::StdArc, (fst::StringType)2u>; uint64 = long long unsigned int]’
external/srec/tools/thirdparty/OpenFst/fst/lib/test-properties.h:232:70:   required from ‘uint64 fst::TestProperties(const fst::Fst<A>&, uint64, uint64*) [with Arc = fst::GallicArc<fst::StdArc, (fst::StringType)2u>; uint64 = long long unsigned int]’
external/srec/tools/thirdparty/OpenFst/fst/lib/factor-weight.h:376:62:   required from ‘uint64 fst::FactorWeightFst<A, F>::Properties(uint64, bool) const [with A = fst::GallicArc<fst::StdArc, (fst::StringType)2u>; F = fst::GallicFactor<int, fst::TropicalWeight, (fst::StringType)2u>; uint64 = long long unsigned int]’
external/srec/tools/grxmlcompile/grxmlcompile.cpp:938:1:   required from here
external/srec/tools/thirdparty/OpenFst/fst/lib/connect.h:102:8: warning: unused parameter ‘s’ [-Wunused-parameter]
   bool TreeArc(StateId s, const A &arc) { return true; }
        ^
external/srec/tools/thirdparty/OpenFst/fst/lib/connect.h:102:8: warning: unused parameter ‘arc’ [-Wunused-parameter]
make: *** [<span style="color:#ff0000;">out/host/linux-x86/obj/EXECUTABLES/grxmlcompile_intermediates/grxmlcompile.o</span>] Error 1
make: *** Waiting for unfinished jobs....
问题三
external/srec/tools/thirdparty/OpenFst/fst/lib/cache.h:132:26: note: declarations in dependent base ‘fst::VectorFstBaseImpl<fst::CacheState<fst::GallicArc<fst::StdArc, (fst::StringType)0u> > >’ are not found by unqualified lookup
external/srec/tools/thirdparty/OpenFst/fst/lib/cache.h:132:26: note: use ‘this->SetState’ instead
external/srec/tools/thirdparty/OpenFst/fst/lib/cache.h:136:61: error: ‘SetState’ was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
SetState(cache_first_state_id_, cache_first_state_);

make: *** [ out/host/linux-x86/obj/EXECUTABLES/grxmlcompile_intermediates/grxmlcompile.o] Error 1

解决办法:
cd external/srec
wget "https://github.com/CyanogenMod/android_external_srec/commit/4d7ae7b79eda47e489669fbbe1f91ec501d42fb2.diff"
patch -p1 < 4d7ae7b79eda47e489669fbbe1f91ec501d42fb2.diff
rm -f 4d7ae7b79eda47e489669fbbe1f91ec501d42fb2.diff
cd ../..


问题四:
dalvik/vm/native/dalvik_system_Zygote.cpp:216:43: error: ‘setrlimit’ was not declared in this scope
err = setrlimit(contents[0], &rlim);

^
<command-line>:0:0: warning: "_FORTIFY_SOURCE" redefined [enabled by default]
dalvik/vm/native/java_lang_Float.cpp:1:0: note: this is the location of the previous definition
/*
^
make: *** [out/host/linux-x86/obj/SHARED_LIBRARIES/libdvm_intermediates/native/dalvik_system_Zygote.o] Error 1
make: *** Waiting for unfinished jobs....

解决办法
添加头文件#include <sys/resource.h>到以下文件
dalvik/vm/native/dalvik_system_Zygote.cpp

问题五
host C: libdiskconfig_host <= system/core/libdiskconfig/diskconfig.c
cc1: all warnings being treated as errors
<command-line>:0:0: error: "_FORTIFY_SOURCE" redefined [-Werror]
make: *** [out/host/linux-x86/obj/EXECUTABLES/editdisklbl_intermediates/editdisklbl.o] Error 1
make: *** Waiting for unfinished jobs....
system/core/libdiskconfig/diskconfig.c:1:0: note: this is the location of the previous definition
/* libs/diskconfig/diskconfig.c
^
cc1: all warnings being treated as errors
make: *** [out/host/linux-x86/obj/STATIC_LIBRARIES/libdiskconfig_host_intermediates/diskconfig.o] Error 1

解决办法
gcc和g++版本太高了
sudo apt-get install gcc-4.4
sudo apt-get install g++-4.4
sudo rm -rf /usr/bin/gcc /usr/bin/g++
sudo ln -s /usr/bin/gcc-4.4 /usr/bin/gcc
sudo ln -s /usr/bin/g++-4.4 /usr/bin/g++

把默认的4.6版本换为了4.4,继续编译源码make -j2

漫长的等待........................................

编译了大半天,结果还是没通过

make: *** [out/host/common/obj/JAVA_LIBRARIES/core-tests-hostdex_intermediates/classes.dex] Killed
make: *** Waiting for unfinished jobs....
根据网上的说法是有可能内存不够了


解决办法:虚拟机内存不够,增大内存试试

还是报了以下问题:

target C++: libbcc <= frameworks/compile/libbcc/lib/ExecutionEngine/bcc.cpp
target C: libbcc <= out/target/product/vbox_x86/obj/SHARED_LIBRARIES/libbcc_intermediates/libbcc-stamp.c
i686-android-linux-gcc: Internal error: Killed (program cc1)
Please submit a full bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
make: *** [out/target/product/vbox_x86/obj/SHARED_LIBRARIES/libbcc_intermediates/libbcc-stamp.o] Error 1
make: *** Waiting for unfinished jobs....
再尝试增大存储空间


问题七:

'out/target/common/obj/JAVA_LIBRARIES/services_intermediates//classes.dex' as 'classes.dex'...
Install: out/target/product/vbox_x86/system/bin/system_server
Install: out/target/product/vbox_x86/system/lib/libfilterpack_imageproc.so
target Strip: libwebcore (out/target/product/vbox_x86/obj/lib/libwebcore.so)
make: *** [out/target/product/vbox_x86/obj/lib/libwebcore.so] Error 1
make: *** Waiting for unfinished jobs....

解决办法:
Ubuntu系统没加swap分区
root@ubuntu:/home/dzt/android/WORKING_DIRECTORY# dd if=/dev/zero of=/opt/moreswap bs=1024 count=512k
524288+0 records in
524288+0 records out
536870912 bytes (537 MB) copied, 54.2059 s, 9.9 MB/s
root@ubuntu:/home/dzt/android/WORKING_DIRECTORY# mkswap /opt/moreswap
Setting up swapspace version 1, size = 524284 KiB
no label, UUID=6916a5ef-2b51-4716-a4a1-6ac7a1edcc0d
root@ubuntu:/home/dzt/android/WORKING_DIRECTORY# swapon /opt/moreswap
root@ubuntu:/home/dzt/android/WORKING_DIRECTORY# gedit /etc/fstab
把这句话添加到最后一行
/opt/moreswap none swap sw 0 0
root@ubuntu:/home/dzt/android/WORKING_DIRECTORY# swapon -s
Filename Type Size Used Priority
/dev/sda5 partition 1046524 200872 -1
/opt/moreswap file 524284 0 -2

问题八:
host Executable: emulator_renderer (out/host/linux-x86/obj/EXECUTABLES/emulator_renderer_intermediates/emulator_renderer)
/usr/bin/ld: out/host/linux-x86/obj/EXECUTABLES/emulator_renderer_intermediates/main.o: undefined reference to symbol 'XInitThreads'
//usr/lib/i386-linux-gnu/libX11.so.6: error adding symbols: DSO missing from command line
collect2: ld returned 1 exit status
make: *** [out/host/linux-x86/obj/EXECUTABLES/emulator_renderer_intermediates/emulator_renderer] Error 1
make: *** Waiting for unfinished jobs....


解决办法:
修改development/tools/emulator/opengl/host/renderer/Android.mk文件
root@ubuntu:/home/dzt/android/WORKING_DIRECTORY# ls
abi cts docs frameworks Makefile prebuilt
bionic dalvik download.sh hardware ndk sdk
bootable development download.sh~ hs_err_pid6190.log out system
build device external libcore packages v8.log
root@ubuntu:/home/dzt/android/WORKING_DIRECTORY# gedit development/tools/emulator/opengl/host/renderer/Android.mk

添加一行:LOCAL_LDLIBS += -lX11 注意最好是复制过去,右边的容易写错



由于机器配置的问题,经过多次make -j4,终于成功了


最后对单个设置模块源码进行编译

root@ubuntu:/home/dzt/android/WORKING_DIRECTORY# source build/envsetup.sh
including device/samsung/maguro/vendorsetup.sh
including device/samsung/tuna/vendorsetup.sh
including device/ti/panda/vendorsetup.sh
including sdk/bash_completion/adb.bash
root@ubuntu:/home/dzt/android/WORKING_DIRECTORY# lunch 3

============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=4.0.1
TARGET_PRODUCT=vbox_x86
TARGET_BUILD_VARIANT=eng
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=x86
TARGET_ARCH_VARIANT=x86
HOST_ARCH=x86
HOST_OS=linux
HOST_BUILD_TYPE=release
BUILD_ID=ITL41D
============================================

root@ubuntu:/home/dzt/android/WORKING_DIRECTORY# mmm packages/apps/Settings/
============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=4.0.1
TARGET_PRODUCT=vbox_x86
TARGET_BUILD_VARIANT=eng
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=x86
TARGET_ARCH_VARIANT=x86
HOST_ARCH=x86
HOST_OS=linux
HOST_BUILD_TYPE=release
BUILD_ID=ITL41D
============================================
make: Entering directory `/home/dzt/android/WORKING_DIRECTORY'
target R.java/Manifest.java: Settings (out/target/common/obj/APPS/Settings_intermediates/src/R.stamp)
(skipping backup file 'packages/apps/Settings/res/values-zh-rCN/strings.xml~')
target Java: Settings (out/target/common/obj/APPS/Settings_intermediates/classes)
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Copying: out/target/common/obj/APPS/Settings_intermediates/classes-jarjar.jar
Copying: out/target/common/obj/APPS/Settings_intermediates/emma_out/lib/classes-jarjar.jar
Copying: out/target/common/obj/APPS/Settings_intermediates/classes.jar
Copying: out/target/common/obj/APPS/Settings_intermediates/noproguard.classes.jar
target Dex: Settings
Copying: out/target/common/obj/APPS/Settings_intermediates/noproguard.classes.dex
target Package: Settings (out/target/product/vbox_x86/obj/APPS/Settings_intermediates/package.apk)
(skipping backup file 'packages/apps/Settings/res/values-zh-rCN/strings.xml~')
'out/target/common/obj/APPS/Settings_intermediates//classes.dex' as 'classes.dex'...
Install: out/target/product/vbox_x86/system/app/Settings.apk
target Java: SettingsTests (out/target/common/obj/APPS/SettingsTests_intermediates/classes)
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Copying: out/target/common/obj/APPS/SettingsTests_intermediates/classes-jarjar.jar
Copying: out/target/common/obj/APPS/SettingsTests_intermediates/emma_out/lib/classes-jarjar.jar
Copying: out/target/common/obj/APPS/SettingsTests_intermediates/classes.jar
Copying: out/target/common/obj/APPS/SettingsTests_intermediates/noproguard.classes.jar
target Dex: SettingsTests
Copying: out/target/common/obj/APPS/SettingsTests_intermediates/noproguard.classes.dex
target Package: SettingsTests (out/target/product/vbox_x86/obj/APPS/SettingsTests_intermediates/package.apk)
'out/target/common/obj/APPS/SettingsTests_intermediates//classes.dex' as 'classes.dex'...
Install: out/target/product/vbox_x86/data/app/SettingsTests.apk
make: Leaving directory `/home/dzt/android/WORKING_DIRECTORY'
使用lunch命令时要注意,后面带的数字

root@ubuntu:/home/dzt/android/WORKING_DIRECTORY# lunch

You're building on Linux

Lunch menu... pick a combo:
1. full-eng
2. full_x86-eng
3. vbox_x86-eng
4. full_maguro-userdebug
5. full_tuna-userdebug
6. full_panda-eng

Which would you like? [full-eng]

我选择的是3. vbox_x86-eng就直接输入lunch 3

环境搭建好了,可以对源码进行二次开发,可以定制自己的系统样式,学习优秀的代码。这个环境搭建真不容易!

Android编译环境搭建和源码编译总结:

编译的过程中不知使用了多少次make -j2这个命令,每改一个问题就make一次,每次make都需要花很多时间。每个人碰到的问题都不一样,千奇百怪,但基本每个问题都能在网上找到解决办法,把问题在网上一搜就能找出好多答案,要具体问题具体分析。

编译完后可以运行模拟器

dzt@dzt-All-Series:~/D/workarea/android_source_4.4$ emulator
就可以看到以下界面

还可以修改后再编译运行,看下我们修改过的系统

参考资料:

http://blog.csdn.net/evilcode/article/details/7005757

http://www.linuxidc.com/Linux/2014-03/97625.htm

http://www.linuxidc.com/Linux/2011-11/47642.htm

http://blog.163.com/haoge03180318@126/blog/static/119585844201242993450903/

http://blog.csdn.net/zhengmeifu/article/details/7705051

http://www.cnblogs.com/qianxudetianxia/p/3681890.html

2014.10.08 add

1. install ubuntu 12.04 LTS
2. install update through updatemanager
3. $ sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl libc6-dev libncurses5-dev:i386 x11proto-core-dev libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-glx:i386 libgl1-mesa-dev g++-multilib mingw32 openjdk-6-jdk tofrodos python-markdown libxml2-utils xsltproc zlib1g-dev:i386
$ sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so
4. sudo cp jdk-6u29-linux-x64.bin /usr/lib/jvm/jdk-6u29-linux-x64.bin
5. cd /usr/lib/jvm/
6. sudo chmod 777 jdk-6u29-linux-x64.bin
7. sudo ./jdk-6u29-linux-x64.bin
8. sudo vim /etc/profile
9. add env var:
export JAVA_HOME=/usr/lib/jvm/jdk1.6.0_29
export PATH=$JAVA_HOME/bin:$JAVA_HOME/jar/bin:/usr/bin/SVNDownload:$PATH
export CLASSPATH=.:$JAVA_HOME/lib:$JAVA_HOME/jar/lib:$CLASSPATH
10. change java default setting from openjava to install java
[
1. "ls -l /usr/bin/ja*" to look java command path
2. "ls -l /etc/alternatives/ja*" to look java command path
3. sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.6.0_29/bin/java 1
4. repeat above step for javac, javadoc, javah, javap, javaws, jar, jarsigner
5. "sudo update-alternatives --config java" to change java alternatives cfg
6. repeat above step to change alternatives cfgs for javac, javadoc, javah, javap, javaws, jar, jarsigner
]

before install gcc4.4, PLEASE install virtualbox to avoid install virtualbox error
11. install gcc4.4 and change gcc default setting for gcc4.6 to gcc4.4
[
sudo apt-get install gcc-4.4
sudo apt-get install g++-4.4
sudo apt-get install gcc-4.4-multilib
sudo apt-get install g++-4.4-multilib
cd /usr/bin
ls -l gcc*
sudo mv gcc gcc.bak
sudo ln -s gcc-4.4 gcc

sudo mv g++ g++.bak
sudo ln -s g++-4.4 g++

sudo mv x86_64-linux-gnu-cpp x86_64-linux-gnu-cpp.bak
sudo ln -s cpp-4.4 x86_64-linux-gnu-cpp

sudo mv x86_64-linux-gnu-g++ x86_64-linux-gnu-g++.bak
sudo ln -s g++-4.4 x86_64-linux-gnu-g++

sudo mv x86_64-linux-gnu-gcc x86_64-linux-gnu-gcc.bak
sudo ln -s gcc-4.4 x86_64-linux-gnu-gcc

sudo mv gcov gcov.bak
sudo ln -s gcov-4.4 gcov
]

12. install svn 1.7
[
sudo apt-add-repository ppa:dominik-stadler/subversion-1.7
sudo apt-get update
sudo apt-get install subversion
]

13. install oracle vm virtualbox
[
download latest virtualbox and VirtualBox_Extension_Pack on https://www.virtualbox.org/wiki/Downloads
intall
]

14. other tools maybe required: wine, vim, ssh, filezilla, beyondcompare, sourceinsight

add by 2015.05.08

 sudo apt-get install gnome-system-tools
安装这个工具解决Ubuntu12.04下虚拟机usb无法识别问题

  • 1
    点赞
  • 1
    评论
  • 0
    收藏
  • 打赏
    打赏
  • 扫一扫,分享海报

©️2022 CSDN 皮肤主题:大白 设计师:CSDN官方博客 返回首页

打赏作者

dztai

你的鼓励将是我创作的最大动力

¥2 ¥4 ¥6 ¥10 ¥20
输入1-500的整数
余额支付 (余额:-- )
扫码支付
扫码支付:¥2
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、C币套餐、付费专栏及课程。

余额充值