android源码编译

来源:互联网 发布:dz论坛整站源码 编辑:程序博客网 时间:2024/05/29 13:57

一.http://source.android.com/source/building-running.html

二.编译过程中出现问题

1.<命令行>:0:0: 错误: “_FORTIFY_SOURCE”重定义 [-Werror]
<built-in>:0:0: 附注: 这是先前定义的位置
cc1plus: all warnings being treated as errors

修改build/core/combo/HOST_linux-x86.mk 61行,将
HOST_GLOBAL_CFLAGS += -D_FORTIFY_SOURCE=0
修改成
HOST_GLOBAL_CFLAGS += -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0

2.In file includedfrom external/oprofile/libpp/arrange_profiles.cpp:24:0:
external/oprofile/libpp/format_output.h:94:22: error: reference‘counts’ cannot be declared ‘mutable’ [-fpermissive]
make: ***[out/host/linux-x86/obj/STATIC_LIBRARIES/liboprofile_pp_intermediates/arrange_profiles.o]Error 1
解决办法:
external/oprofile/libpp/format_output.h

把:
mutable counts_t & counts;
改为:
counts_t & counts

3.

make: *** [out/host/linux-x86/obj/STATIC_LIBRARIES/libgtest_host_intermediates/gtest-all.o] 错误 1


gedit external/gtest/include/gtest/internal/gtest-param-util.h

添加

#include <cstddef>

4.make: *** [out/host/linux-x86/obj/EXECUTABLES/test-librsloader_intermediates/test-librsloader] 错误 1

 gedit external/llvm/llvm-host-build.mk


#编译不过

LOCAL_LDLIBS:=-lpthread -ldl

5

make: *** [out/host/linux-x86/obj/EXECUTABLES/llvm-rs-cc_intermediates/slang_rs_export_foreach.o] Error 1
 解决方法:
在工程根目录下,打开下面的makefile文件:
$ vi frameworks/compile/slang/Android.mk 

在打开的makefile文件中按照下面更改:
#local_cflags_for_slang := -Wno-sign-promo -Wall -Wno-unused-parameter -Werror
local_cflags_for_slang := -Wno-sign-promo -Wall -Wno-unused-parameter


6.编译 MAKE SDK

Package SDK: out/host/linux-x86/sdk/android-sdk_eng.wangwei_linux-x86.zip

development/build/sdk.atree:229: couldn't locate source file: framework/layoutlib-tests.jar
development/build/sdk.atree:230: couldn't locate source file: system/app/ConnectivityTest.apk
development/build/sdk.atree:231: couldn't locate source file: system/app/GpsLocationTest.apk
sdk/build/tools.atree:47: couldn't locate source file: usr/share/pc-bios/bios.bin
sdk/build/tools.atree:48: couldn't locate source file: usr/share/pc-bios/vgabios-cirrus.bin
sdk/build/tools.atree:146: couldn't locate source file: framework/ddmlib-tests.jar
sdk/build/tools.atree:147: couldn't locate source file: framework/ninepatch-tests.jar
sdk/build/tools.atree:148: couldn't locate source file: framework/common-tests.jar
sdk/build/tools.atree:149: couldn't locate source file: framework/sdklib-tests.jar
sdk/build/tools.atree:150: couldn't locate source file: framework/sdkuilib-tests.jar

make: *** [out/host/linux-x86/sdk/android-sdk_eng.wangwei_linux-x86.zip] 错误 44



解决方法如下:

$ source build/envsetup.sh

initialize some commands for android compile system

$lunch sdk-eng

The item have not been listed in the printed console list, but it still support the function

$make sdk


7.编译过SDK后  运行模拟器

/home/zhujc/androidSource/out/host/linux-x86/bin/emulator

  1. $cd out/host/linux-x86/sdk/android-sdk_eng.xxx_linux-x86/tools  
  2. $./android list targets  
  3. Available Android targets:  
  4. ----------  
  5. id: 1 or "android-14"  
  6.      Name: Android 4.0  
  7.      Type: Platform  
  8.      API level: 14  
  9.      Revision: 2  
  10.      Skins: QVGA, WSVGA, HVGA, WVGA854, WXGA720, WQVGA432, WVGA800 (default), WQVGA400, WXGA800  
  11.      ABIs : armeabi-v7a  
  12.   
  13. $./android create avd -t 1 -n ics  
  14. Auto-selecting single ABI armeabi-v7a  
  15. Android 4.0 is a basic Android platform.  
  16. Do you wish to create a custom hardware profile [no]  
  17. Created AVD 'ics' based on Android 4.0, ARM (armeabi-v7a) processor,  
  18. with the following hardware config:  
  19. hw.lcd.density=240  
  20. vm.heapSize=24  
  21. hw.ramSize=512  
  22.   
  23. $./emulator -avd testYM

8.修改LUANCHER2下面一张图片资源

编译模块之后,SDK也被清除,重新编译SDK后才可以运行模拟器

编译:

source build/envsetup.sh

mmm packages/apps/Launcher2

lunch sdk-eng

make sdk

然后再进入

cd out/host/linux-x86/sdk/android-sdk_eng.xxx_linux-x86/tools 
./emulator -avd testYM


原创粉丝点击