首先必须降低gcc版本:

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++

################ Fix 1 ##########################

Error:

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

################## Fix 2 ##########################

Error

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::wp<android::AssetManager::SharedZip> >' 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/STATIC_LIBRARIES/libutils_intermediates/AssetManager.o] Error 1

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

Add '-fpermissive' to line 64:
LOCAL_CFLAGS += -DLIBUTILS_NATIVE=1 $(TOOL_CFLAGS) -fpermissive

问题三
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-dependentlookup 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 ../..

此方法是我找的别人对于4.0版本源码问题的解决方法,我用在了2.3上,没有出现问题

dalvik_system_Zygote.c:191:19: error: storage size of 'rlim' isn't known

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

<command-line>:0:0: error:"_FORTIFY_SOURCE" redefined[-Werror]

解决办法
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++

Can't locate Switch.pm in @INC (you may need to install the Switch module) (@INC

contains: external/webkit/WebCore/bindings/scripts /etc/perl /usr/local/lib/per

l/5.18.2 /usr/local/share/perl/5.18.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/p

erl/5.18 /usr/share/perl/5.18 /usr/local/lib/site_perl .) at external/webkit/Web

Core/dom/make_names.pl line 38.

BEGIN failed--compilation aborted at external/webkit/WebCore/dom/make_names.pl l

ine 38.

Can't locate Switch.pm in @INC (you may need to install the Switch module) (@INC

contains: external/webkit/WebCore/bindings/scripts /etc/perl /usr/local/lib/per

l/5.18.2 /usr/local/share/perl/5.18.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/p

erl/5.18 /usr/share/perl/5.18 /usr/local/lib/site_perl .) at external/webkit/Web

Core/dom/make_names.pl line 38.

BEGIN failed--compilation aborted at external/webkit/WebCore/dom/make_names.pl l

ine 38.

解决方法是安装perlswitch库:

[plain]view plaincopy

  1. sudoapt-getinstalllibswitch-perl

更多相关文章

  1. 解决报错:The versions of the Android(安卓)Gradle plugin and G
  2. 更改Android(安卓)AppCompatRadioButton控件的样式和颜色
  3. Android(安卓)Matrix
  4. AOSP Android(安卓)源码
  5. PowerManager源码
  6. Android(安卓)SharedPreference源码浅析
  7. 下拉刷新SwipeRefreshLayout源码
  8. 查看Android(安卓)ADT Plugin版本的方法
  9. Android(安卓)studio之蓝牙

随机推荐

  1. Android(安卓)ORM 框架——GreenDao的基
  2. phonegap在android中应用
  3. JS获取整个HTML网页代码 - Android(安卓)
  4. Android(安卓)部分内容设置颜色、字体、
  5. android 模拟器中启用相机API支持
  6. Android(安卓)Permission denied 错误(附
  7. 设置ProgressBar的颜色
  8. 在 Android(安卓)中使用 Activity, Servi
  9. Android(安卓)stuio在MainActivity中运行
  10. Android例子—设置Activity全屏的三种方