安卓编译遇到如下的错误:
prebuilts/gcc/linux-x86/x86/x86_64-linux-android-4.9/bin/x86_64-linux-android-strip:
out/target/product/generic_x86_64/symbols/system/bin/devmem2:
File format not recognized
[ 0% 4/74832] Check module type:
out/target/product/generic_x86_64/obj_x86/SHARED_LIBRARIES/libartd_intermediates/link_type
ninja: build stopped: subcommand failed.
19:18:29 ninja failed with: exit status 1
out/target/product/generic_x86_64/symbols/system/bin/devmem2:
File format not recognized
根据这两句话可以在命令窗口查看一下
file out/target/product/generic_x86_64/symbols/system/bin/devmem2 看一下这个文件的类型
然后查看文件内容
cat out/target/product/generic_x86_64/symbols/system/bin/devmem2
内容如下
version https://git-lfs.github.com/spec/v1
oid sha256:084bd932c0131ce214f9b08c150e25c6d6f158a200fdef74e521e47f20e8cce1
size 11008
原来这个文件size过大,所以文件以hash值的形式存储,这个时候需要使用工具 git-lfs来把hash值变成编译需要的文件
使用命令 repo forall -c "git-lfs pull"
以下为git-lfs的安装
git lfs是用于git用于存放大文件的客户端工具,需要新版本的git支持
注意:unbuntu 14.10或者其他的非LTS版本的软件仓库一类的社区都已经不维护了,请更新系统, 推荐是ubuntu 16.04 系统
第一步:Ubuntu安装新版git
sudo add-apt-repository ppa:git-core/ppa
sudo apt-get update
sudo apt-get install git
git config --global ssh.variant ssh
第二步:Ubuntu安装git lfs
curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | sudo bash
sudo apt-get install git-lfs
sudo git lfs install --system
第三步:安装后请新建目录重新获取代码,避免代码环境不一致导致取代码和编译问题。
然后make即可