1. 程式人生 > >搭建Ubuntu14.04編譯環境並下載原始碼(二)

搭建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

[email protected]:/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
第二步
[email protected]:/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">[email protected]:/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。
[email protected]:/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)
重新編譯,還是不行。
[email protected]:/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:

[email protected]:/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
[email protected]:/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) ...
還是報錯了
[email protected]:/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分割槽
[email protected]buntu:/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
[email protected]:/home/dzt/android/WORKING_DIRECTORY# mkswap /opt/moreswap
Setting up swapspace version 1, size = 524284 KiB
no label, UUID=6916a5ef-2b51-4716-a4a1-6ac7a1edcc0d
[email protected]:/home/dzt/android/WORKING_DIRECTORY# swapon /opt/moreswap
[email protected]:/home/dzt/android/WORKING_DIRECTORY# gedit /etc/fstab
把這句話新增到最後一行
/opt/moreswap none swap sw 0 0
[email protected]:/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檔案
[email protected]:/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
[email protected]:/home/dzt/android/WORKING_DIRECTORY# gedit development/tools/emulator/opengl/host/renderer/Android.mk

新增一行:LOCAL_LDLIBS += -lX11 注意最好是複製過去,右邊的容易寫錯


由於機器配置的問題,經過多次make -j4,終於成功了


最後對單個設定模組原始碼進行編譯

[email protected]:/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
[email protected]:/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
============================================

[email protected]:/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命令時要注意,後面帶的數字

[email protected]:/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都需要花很多時間。每個人碰到的問題都不一樣,千奇百怪,但基本每個問題都能在網上找到解決辦法,把問題在網上一搜就能找出好多答案,要具體問題具體分析。

編譯完後可以執行模擬器

[email protected]:~/D/workarea/android_source_4.4$ emulator
就可以看到以下介面

還可以修改後再編譯執行,看下我們修改過的系統

參考資料:

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無法識別問題

相關推薦

搭建Ubuntu14.04編譯環境下載原始碼

今天臨時買了個VPN的帳號,繼續下載,翻牆的感覺還是不錯的,推薦一下:VPN 使用repo sync時會經常中斷,所以有人寫了一個指令碼,我就直接拿來用了download.sh,需要改下屬性chomd a+x download.sh #!/bin/bash

如何在eclipse中搭建Android環境,分步解析

今天就教大家win10如何配置JDK 1.開啟你的環境變數 2.在環境變數裡面建立一個JAVA_HOME(變數值寫你下載的JDK的路徑)   3.開啟系統變數中的Path   4.點選新建,將jdk中的bin路徑和jdk中jre下的bin的路徑,寫a

Ubuntu14.04安裝和配置ROS Indigo

安裝ROS 配置Ubuntu的軟體源 配置Ubuntu要求允許接受restricted、universe和multiverse的軟體源,可以根據下面的連結配置: 配置成如下圖所示即可,一般情況下,這些配置都是預設的。 軟體源配置 新增軟體源到sources.list

SpringMVC中文件的上傳上傳到服務器下載問題--------下載

cat exc stream log trac close pri page fin 一、建立一個簡單的jsp頁面。 我們在建好的jsp的頁面中加入一個超鏈接:<a href="${pageContext.request.contextPath}/down

發模型——Master-Worker模式

string 程序 分配任務 之一 size void con .exe || Master-Worker模式是常用的並行模式之一,它的核心思想是,系統有兩個進程協作工作:Master進程,負責接收和分配任務;Worker進程,負責處理子任務。當Worker進程將子任

發容器阻塞隊列詳細介紹

才會 ddc ray add seq 插入數據 裏的 返回 utl 1. 什麽是阻塞隊列? 阻塞隊列(BlockingQueue) 是一個支持兩個附加操作的隊列。這兩個附加的操作是:在隊列為空時,獲取元素的線程會等待隊列變為非空。當隊列滿時,存儲元素的線程會等待隊列可用。阻

【從零開始搭建自己的.NET Core Api框架】搭建項目的整體架構

config 七層 數據 TP 暫時 整體架構 比較 架構 其他 本來打算將搭建項目架構和集成SqlSugar放在一起講的,但是感覺東西有點多,還是分成兩章吧~ 這一章講搭建項目的整體架構,這裏先把搭建完成後的最終效果放出來,然後再逐個解釋每層的作用。 可以看到這裏一

Java接口多線程發測試

ron size get() 傳說 time() ade fix 功能 例如 原文地址http://www.cnblogs.com/yezhenhan/archive/2012/01/09/2317636.html 這是一篇很不錯的文章,感謝原博主的分享! JAVA多線程實

Zookeeper 原始碼序列化元件 Jute

Zookeeper 原始碼(二)序列化元件 Jute 一、序列化元件 Jute 對於一個網路通訊,首先需要解決的就是對資料的序列化和反序列化處理,在 ZooKeeper 中,使用了Jute 這一序列化元件來進行資料的序列化和反序列化操作。同時,為了實現一個高效的網路通訊程式,良好的通訊協議設計也是至關重要

逐行閱讀redux原始碼combineReducers

前情提要 逐行閱讀redux原始碼(一)createStore 認識reducers 在我們開始學習原始碼之前,我們不妨先來看看何謂reducers: 如圖所見,我們可以明白, reducer 是用來對初始的狀態樹進行一些處理從而獲得一個新的狀態樹的,我們可以繼續從其使用方

搭建eclipse+tomcat+maven+shiro+springmvc+jpa專案:基本框架搭建

1、pom.xml配置 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://m

資料視覺化學習--------------------下載資料

上章是講得csv,這節是json 1.如何下載資料: 以下程式碼是利用模組urllib函式urlopen()下載資料 #-*-coding:GBK-*- #-*-coding:utf-8-*- from __future__ import (absolute_import,divisio

白話Spring原始碼:spring原始碼分享的思路

做事先列個大綱,這樣思路清晰了才不會亂。 這次spring原始碼系列的部落格每個字我都堅持自己手敲,然後文采不好,但是真實。希望大家喜歡。 大綱: 1.spring框架的理解 2.beanfactory:怎麼建立bean的,怎麼載入xml中bean的定義的 3.AOP 4.a

JavaScript執行環境及作用域——延長作用域鏈

雖然執行環境的型別總共只有兩種——全域性和區域性(函式),但還是有辦法來延長作用域鏈的,這麼說是因為有些語句可以在作用域鏈的前端臨時增加一個變數物件,該變數物件會在程式碼執行後被移除。在兩種情況下會發生這種現象。具體來說,就是當執行流進入下列任何語句時,作用域鏈就會得到加長: try-catch語句的cat

讀OkHttp3原始碼:CertificatePinner鎖定證書

okhttp3 public final class CertificatePinner extends Object 類介紹: 該類用於約束哪些證書是可信的。 鎖定證書可以防止對證書頒發機構相關的攻擊。 它還阻止通過使用者已知或未知的中間證書頒發機構建立的連線。 這個類

Netty 原始碼NioEventLoop 之 Channel 註冊

Netty 原始碼(二)NioEventLoop 之 Channel 註冊 Netty 系列目錄(https://www.cnblogs.com/binarylei/p/10054508.html) 一、Channel 註冊到 NioEventLoop chnnel 初始化完成後就需要將其註冊到對應

MFC/Qt下呼叫caffe原始碼---MFC下呼叫caffe的動態連線庫dll檔案

首先,先看下最後的效果吧。 win7 vs2013 新建一個MFC 工程 注:MFC中如何最簡便的方法將圖片顯示到對話方塊中?大家可以搜下,很多種方法,但是我採用的是最簡單的方法,即將opencv視窗繫結到MFC的PIcture control上。 在:

Linux環境程序間通訊: 訊號(轉)

訊號本質訊號是在軟體層次上對中斷機制的一種模擬,在原理上,一個程序收到一個訊號與處理器收到一箇中斷請求可以說是一樣的。訊號是非同步的,一個程序不必通過任何操作來等待訊號的到達,事實上,程序也不知道訊號到底什麼時候到達。訊號是程序間通訊機制中唯一的非同步通訊機制,可以看作是非同步通知,通知接收訊號的程序有哪些事

Linux環境程序間通訊: 訊號(轉)

從訊號傳送到訊號處理函式的執行完畢對於一個完整的訊號生命週期(從訊號傳送到相應的處理函式執行完畢)來說,可以分為三個重要的階段,這三個階段由四個重要事件來刻畫:訊號誕生;訊號在程序中註冊完畢;訊號在程序中的登出完畢;訊號處理函式執行完畢。相鄰兩個事件的時間間隔構成訊號生命週期的一個階段。 下面闡述四個事件的實

STM32 ISP串列埠燒錄 VB原始碼關鍵程式碼

Option Explicit Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long) Private Decla