ubuntu 16.04編譯 android4.0.1錯誤處理

錯誤一、

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] 錯誤 1
make: *** 正在等待未完成的任務....


fix :

原因是因爲gcc 和 g++的版本過高引起的,解決方法是安裝低版本4.4


sudo apt-get install gcc-4.4 gcc-4.4-multilib g++-4.4 g++-4.4-multilib

sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.4 50

sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.4 100


sudo update-alternatives --config gcc
有 3 個候選項可用於替換 gcc (提供 /usr/bin/gcc)。

  選擇       路徑            優先級  狀態
------------------------------------------------------------
  0            /usr/bin/gcc-4.4   50        自動模式
* 1            /usr/bin/gcc-4.4   50        手動模式
  2            /usr/bin/gcc-4.8   50        手動模式
  3            /usr/bin/gcc-5     40        手動模式

要維持當前值[*]請按<回車鍵>,或者鍵入選擇的編號:
1

sudo update-alternatives --config g++
有 3 個候選項可用於替換 g++ (提供 /usr/bin/g++)。

  選擇       路徑            優先級  狀態
------------------------------------------------------------
  0            /usr/bin/g++-4.4   100       自動模式
* 1            /usr/bin/g++-4.4   100       手動模式
  2            /usr/bin/g++-4.8   100       手動模式
  3            /usr/bin/g++-5     100       手動模式
1

錯誤二、
dalvik/vm/native/dalvik_system_Zygote.cpp: In function ‘int setrlimitsFromArray(ArrayObject*)’:
dalvik/vm/native/dalvik_system_Zygote.cpp:193: error: aggregate ‘rlimit rlim’ has incomplete type and cannot be defined
dalvik/vm/native/dalvik_system_Zygote.cpp:216: error: ‘setrlimit’ was not declared in this scope
make: *** [out/host/linux-x86/obj/SHARED_LIBRARIES/libdvm_intermediates/native/dalvik_system_Zygote.o] 錯誤 1
make: *** 正在等待未完成的任務....


fix:
 vim dalvik/vm/native/dalvik_system_Zygote.cpp
添加頭文件
 #include <sys/resource.h>

 

錯誤三、

Install: out/host/linux-x86/lib/libOpenglRender.so
host Executable: make_cfst (out/host/linux-x86/obj/EXECUTABLES/make_cfst_intermediates/make_cfst)
/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] 錯誤 1
make: *** 正在等待未完成的任務....

fix:
修改development/tools/emulator/opengl/host/renderer/Android.mk文件
vim development/tools/emulator/opengl/host/renderer/Android.mk

添加一行:LOCAL_LDLIBS += -lX11 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章