美文网首页程序员
Ubuntu 18.04编译Android8.1 automot

Ubuntu 18.04编译Android8.1 automot

作者: iKING_SUN | 来源:发表于2018-08-16 17:33 被阅读31次

1、Android8.1源码下载

清华大学AOSP镜像:https://mirrors.tuna.tsinghua.edu.cn/help/AOSP/

(1)repo下载

git clone https://aosp.tuna.tsinghua.edu.cn/git-repo/
chmod a+x git-repo/repo

添加repo(路径目录如:~/git-repo/repo)到PATH环境变量:export PATH=~/git-repo:$PATH

(2)Android源码分支查看

repo init -u https://aosp.tuna.tsinghua.edu.cn/platform/manifest
cd .repo/manifests.git/
git branch -a

(3)Android8.1源码同步

repo init -u https://aosp.tuna.tsinghua.edu.cn/platform/manifest -b android-8.1.0_r41
repo sync

(4)提示无法连接到 gerrit.googlesource.com

更改repo文件行 REPO_URL 为:

REPO_URL = 'https://mirrors.tuna.tsinghua.edu.cn/git/git-repo'

注释repo文件 code行

#  if clone_bundle and _DownloadBundle(url, local, quiet):
#    _ImportBundle(local)

2、Ubuntu 18.04编译环境配置

(1)安装配置Java 8

sudo apt-get install openjdk-8-jdk
sudo apt-get install openjdk-8-jre

(2)配置Android编译依赖

sudo apt-get install libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-dev g++-multilib
sudo apt-get install -y git flex bison gperf build-essential libncurses5-dev:i386
sudo apt-get install tofrodos python-markdown libxml2-utils xsltproc zlib1g-dev:i386
sudo apt-get install dpkg-dev libsdl1.2-dev libesd0-dev
sudo apt-get install git-core gnupg flex bison gperf build-essential  
sudo apt-get install zip curl zlib1g-dev gcc-multilib g++-multilib
sudo apt-get install libc6-dev-i386
sudo apt-get install lib32ncurses5-dev x11proto-core-dev libx11-dev
sudo apt-get install libgl1-mesa-dev libxml2-utils xsltproc unzip m4
sudo apt-get install lib32z-dev ccache

3、Android8.1 编译automotive

(1)编译automotive,lunch 选择 aosp_car_emu_x86_64-userdebug

. build/envsetup.sh
lunch
make -j8

(2)如果lunch后为

9. aosp_car_emu_arm-userdebug
10. aosp_car_emu_arm64-userdebug
11. aosp_car_emu_x86-userdebug
12. aosp_car_emu_x86_64-userdebug

报 build/core/product_config.mk:227: *** Can not locate config makefile for product "aosp_car_emu_x86_64-userdebug". Stop.

直接去掉 _emu 执行:

lunch aosp_car_x86_64-userdebug

(3)FAILED: out/target/product/fugu/obj/STATIC_LIBRARIES/libedify_intermediates/lexer.cpp
/bin/bash -c "prebuilts/misc/linux-x86/flex/flex-2.5.39 -oout/target/product/fugu/obj/STATIC_LIBRARIES/libedify_intermediates/lexer.cpp bootable/recovery/edify/lexer.ll"
flex-2.5.39: loadlocale.c:130:_nl_intern_locale_data: ?? 'cnt < (sizeof (_nl_value_type_LC_TIME) / sizeof (_nl_value_type_LC_TIME[0]))' ???
Aborted (core dumped)
[ 6% 3452/56388] //frameworks/base/libs/androidfw:libandroidfw clang++ ResourceTypes.cpp [linux]
ninja: build stopped: subcommand failed.
09:56:41 ninja failed with: exit status 1

去除所有本地化的设置,让命令能正确执行,bash 执行:

export LC_ALL=C

(4)error: ro.build.fingerprint cannot exceed 91 bytes
更改 build/tools/post_process_props.py 文件行 PROP_VALUE_MAX = 91 为 PROP_VALUE_MAX = 128

#### PROP_VALUE_MAX = 91
PROP_VALUE_MAX = 128

更改 bionic/libc/include/sys/system_properties.h 文件行 #define PROP_VALUE_MAX 91 为 #define PROP_VALUE_MAX 128

#### #define PROP_VALUE_MAX  91
#define PROP_VALUE_MAX  128

更改 frameworks/native/cmds/installd/installd_deps.h 文件行 constexpr size_t kPropertyValueMax = 91u; 为 constexpr size_t kPropertyValueMax = 128u;

#### constexpr size_t kPropertyValueMax = 91u;
constexpr size_t kPropertyValueMax = 128u; 

(5)FAILED: out/target/common/obj/JAVA_LIBRARIES/android_stubs_current_intermediates/classes.jack
/bin/bash -c "(rm -rf out/target/common/obj/JAVA_LIBRARIES/android_stubs_current_intermediates/jack-rsc.tmp ) && (if [ ! -f out/target/common/obj/APPS/framework-res_intermediates/package-export.apk ]; then echo Missing file out/target/common/obj/APPS/framework-res_intermediates/package-export.apk; exit 1; fi ) && (mkdir -p out/target/common/obj/JAVA_LIBRARIES/android_stubs_current_intermediates/jack-rsc.tmp ) && (unzip -qo out/target/common/obj/APPS/framework-res_intermediates/package-export.apk -d out/target/common/obj/JAVA_LIBRARIES/android_stubs_current_intermediates/jack-rsc.tmp ) && (mkdir -p out/target/common/obj/JAVA_LIBRARIES/android_stubs_current_intermediates/ ) && (find out/target/common/obj/JAVA_LIBRARIES/android_stubs_current_intermediates/src -name "*.java" > out/target/common/obj/JAVA_LIBRARIES/android_stubs_current_intermediates/jack-rsc.java-source-list ) && (JACK_VERSION=4.32.CANDIDATE out/host/linux-x86/bin/jack @build/core/jack-default.args -D jack.java.source.version=1.8 -D jack.android.min-api-level=o-b1 --import-resource out/target/common/obj/JAVA_LIBRARIES/android_stubs_current_intermediates/jack-rsc.tmp --output-jack out/target/common/obj/JAVA_LIBRARIES/android_stubs_current_intermediates/classes.jack @out/target/common/obj/JAVA_LIBRARIES/android_stubs_current_intermediates/jack-rsc.java-source-list || ( rm -f out/target/common/obj/JAVA_LIBRARIES/android_stubs_current_intermediates/classes.jack ; out/target/common/obj/JAVA_LIBRARIES/android_stubs_current_intermediates/jack-rsc.tmp ; exit 41 ) ) && (rm -rf out/target/common/obj/JAVA_LIBRARIES/android_stubs_current_intermediates/jack-rsc.tmp )"
No Jack server running. Try 'jack-admin start-server'
jack-admin start-server

jack server未启动,bash 执行:

jack-admin start-server

相关文章

网友评论

    本文标题:Ubuntu 18.04编译Android8.1 automot

    本文链接:https://www.haomeiwen.com/subject/xkmobftx.html