编译安卓源码常见报错

环境:ubuntu16.04、安卓源码2.3.7

报错一:build/core/prebuilt.mk:143: *** recipe commences before first target, stop

        解决办法:降低make的版本

        1、make -v查看make的版本,我的是4.1版本

        2、下载make:地址:http://ftp.gnu.org/gnu/make/ 

        3、解压至ubuntu某个文件夹

        4、解压后文件夹根目录下输入命令:./configure --prefix=/usr/local/make-3.81

        5、然后输入命令编译:sh build.sh 

        6、替换原来的make: sudo cp make /usr/bin/make

        7、make -v查看一下版本是否改变

 

报错二:host Java: apicheck (out/host/common/obj/JAVA_LIBRARIES/apicheck_intermediates/classes)
/bin/bash: jar: 未找到命令

       解决办法:建立jdk连接

      1、输入java -version查看是否成功安装了jdk

      2、确认成功安装了jdk后,建立软连接

      

 

报错三:external/clearsilver/java-jni/../util/neo_err.h:88:69: error: expected expression before ‘)’ token(这个问题比较难搞,查了一天资料)
    nerr_raisef(__PRETTY_FUNCTION__,__FILE__,__LINE__,e,f,__VA_ARGS__)

      解决办法:https://stackoverflow.com/questions/42979203/c-macro-compilation-error-aosp-external-clearsilver-util-neo-err-h

android-2.3.7_r1/external/clearsilver/util/neo_err.h

 

报错四:frameworks/base/include/utils/KeyedVector.h:193:27: error: ‘indexOfKey’ was not declared in this scope

          解决办法:

       vi frameworks/base/tools/aapt/Android.mk
      Add '-fpermissive' to line 27:
      LOCAL_CFLAGS += -Wno-format-y2k -fpermissive

 

报错五:frameworks/base/include/utils/KeyedVector.h:193:27: error: ‘indexOfKey’ was not declared in this scope

       解决办法:

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

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

报错六:ModuleNotFoundError: No module named ‘_ctypes’,和python有关的错误。之前查资料说是要把python的版本升至3.6以上,升上去之后又出现了新问题,虚拟机装了2.7,3.5,3.7.1三个版本的python,无奈,可能是我安装3.7版本的时候下载了很多相关软件,最后用2.7版本的编译没问题。

报错七:external/srec/tools/thirdparty/OpenFst/fst/lib/cache.h:132:17: note: use ‘this->SetState’ instead

external/srec/tools/thirdparty/OpenFst/fst/lib/cache.h:132:17: error: ‘SetState’ was not declared in this scope

       解决办法:

     第一步: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.c:191:19: error: storage size of ‘rlim’ isn’t known

    解决办法:

dalvik/vm/native/dalvik_system_Zygote.c里面加上头文件#include <sys/resource.h>

 

报错九:collect2: error: ld returned 1 exit status

make: *** [out/host/linux-x86/obj/lib/libdvm.so] Error 1
   解决办法:

    sudo apt-get install lib64z1-dev

 

报错十:apt-get安装软件的时候:报错/var/cache/apt/archives/libc6-dev-amd64_2.23-0ubuntu11.3_i386.deb

     解决办法:

sudo dpkg -i --force-overwrite /var/cache/apt/archives/*.deb

*为错误信息(--unpack)前面的那个deb文件

 

报错十一:编译成功后输入emulator报错SDL init failure, reason is: No available video device

      解决办法:sudo apt-get install libsdl1.2debian:i386

      

 

  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值