1.怎么在Eclipse中查看Android API源码以及support包源码
2.在android4.0.几的版本上会出现这个问题,在线求解答
怎么在Eclipse中查看Android API源码以及support包源码
查看AndroidAPI源码:
1、第一步:选中Android项目,鼠标右键“Properties——》Java
Build
Path——》Libraries”
2、第二步:展开添加的SDK库文件,例如Android
4.0,私服源码泄露选中Source
attachment,考试预约系统源码最后点击“编辑”
3、第三步:关联本地的Android源码文件,选中源码存放位置
在android4.0.几的版本上会出现这个问题,在线求解答
在尝试编译Android 4.0.x版本的源码时,遇到的问题多种多样。以下是将这些问题及其解决方案列举出来的内容,条目之间换行,以清晰的买入点指标源码条目编号呈现。
1. 错误:/usr/include/gnu/stubs.h:7:: error: gnu/stubs-.h: No such file or directory
解决:sudo apt-get install libc6-dev-i
2. 错误:make: *** [out/host/linux-x/obj/EXECUTABLES/acp_intermediates/acp] error 1
解决:sudo apt-get install g++-4.4-multilib
3. 错误:external/clearsilver/cgi/cgi.c:: fatal error: zlib.h: No such file or directory
解决:sudo apt-get install zlib1g-dev
4. 错误:/usr/bin/ld: cannot find -lz
解决:sudo apt-get install libz1-dev
5. 错误:bison -d -o out/host/linux-x/obj/EXECUTABLES/aidl_intermediates/aidl_language_y.cpp frameworks/base/tools/aidl/aidl_language_y.y
解决:sudo apt-get install bison
6. 错误:Lex: aidl <= frameworks/base/tools/aidl/aidl_language_l.l
解决:sudo apt-get install flex
7. 错误:/usr/bin/ld: cannot find -lncurses
解决:sudo apt-get install libncurses5-dev
8. 错误:prebuilt/linux-x/sdl/include/SDL/SDL_syswm.h:: fatal error: X/Xlib.h: No such file or directory
解决:sudo apt-get install libx-dev
9. 错误:sh: gperf: not found
解决:sudo apt-get install gperf
. 错误:build/core/java.mk:9: *** bin: Target java module does not define any source or resource files. Stop.
解决:删除源码根目录下的bin文件夹,这个文件夹是导入eclipse时创建的。
. 错误:/usr/bin/ld: cannot find -lX
解决:sudo ln -s /usr/lib/i-linux-gnu/libX.so.6 /usr/lib/i-linux-gnu/libX.so
. 错误:development/tools/emulator/opengl/host/libs/Translator/GLDispatch.cpp:: fatal error: GL/glx.h: No such file or directory
解决:sudo apt-get install libgl1-mesa-dev
. 错误:host SharedLib: libEGL_translator (out/host/linux-x/obj/lib/libEGL_translator.so)
解决:sudo apt-get install libglu1-mesa-dev
. 错误:host StaticLib: libGLcommon (out/host/linux-x/obj/STATIC_LIBRARIES/libGLcommon_intermediates/libGLcommon.a)
解决:sudo ln -s /usr/lib/i-linux-gnu/mesa/libGL.so.1 /usr/lib/i-linux-gnu/libGL.so
. 错误:make: *** [out/host/linux-x/obj/EXECUTABLES/obbtool_intermediates/Main.o] Error 1
后来发现了,原来是优汇宝源码Ubuntu .里的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,继续编译源码,又出现了另一个错误,大致提示为:
g++ selected multilib '' not installed
继续奋战吧,牛股起飞 源码安装相应的工具吧:sudo apt-get install g++-4.4-multilib,现在正在make -j8(开启多线程编译(不推荐),可能有时候会出现问题,最好是直接make)
2. 解决各种依赖问题
首先安装一些库
?View Code BASH
1 sudo apt-get install gnupg flex bison gperf libsdl1.2-dev libesd0-dev
2 sudo apt-get install libwxgtk2.6-dev squashfs-tools build-essential
3 sudo apt-get install zlib1g-dev pngcrush schedtool ia-libs libncurses5-dev
这些库可能不全,如果出现问题,再google一下吧
3. error: “_FORTIFY_SOURCE” redefined [-Werror]
这个问题,据说与gcc版本有关,4.4版不会出现。
后来在google code上找到了使用gcc 4.6编译的方法
修改build/core/combo/HOST_linux-x.mk文件line
?View Code BASH
1 -HOST_GLOBAL_CFLAGS += -D_FORTIFY_SOURCE=0
2 +HOST_GLOBAL_CFLAGS += -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0
这是CyanogenMod打上的补丁
4. No rule to make target ‘out/target/product/generic/obj/lib/libcamera.so’
修改 /home/Android-2.3.4/frameworks/base/services/camera/libcameraservice/Android.mk,USE_CAMERA_STUB:=false -> true
?View Code BASH
1 LOCAL_PATH:= $(call my-dir)
2
3 # Set USE_CAMERA_STUB if you don't want to use the hardware camera.
4
5 # force these builds to use camera stub only
6 ifneq ($(filter sooner generic sim,$(TARGET_DEVICE)),)
7 USE_CAMERA_STUB:=true
8 endif
9
#########CHANGE THIS LINE############
USE_CAMERA_STUB:=true
ifeq ($(USE_CAMERA_STUB),)
USE_CAMERA_STUB:=false
endif