I am attempting to build AOSP 8, specifically build android-8.0.0_r22 using lunch 31.
About half way through the build, I have encountered some kind of error where the ANDROID_DATA directory cannot be found.
The error is consistent between running make on my machine running Ubuntu 22.04, and also when running the build in the provided docker container running Ubuntu 14.04 AOSP Development Setup for 2.3-8.0. It's possible my problem is due to setup, but I've tried to follow the instructions closely.
My issue is similar to this other SO post Problem Compiling AOSP with Ubuntu.
Sections of the log that (I think) are relevant follow:
me@0827a715fc7f:/src$ m -j1
make: Entering directory `/src'
============================================
...
PLATFORM_VERSION=8.0.0
...
HOST_OS_EXTRA=Linux-6.5.0-21-generic-x86_64-with-Ubuntu-14.04-trusty
...
============================================
...
[ 0% 2/30419] build out/target/pr...termediates/oat/arm64/package.odex
FAILED: out/target/product/taimen/obj/APPS/KeyChain_intermediates/oat/ar
m64/package.odex
...
dex2oatd F 04-01 17:37:21 1279 1279 utils.cc:761] ANDROID_DATA not set
and /data does not exist
Part of Stack Trace:
native: #05 pc 00000000005ea3c9 /src/out/host/linux-x86/lib64/libartd
.so (art::GetAndroidDir(char const*, char const*)+233)
native: art::GetAndroidDir(char const*, char const*)
native: art/runtime/utils.cc:761
native: #06 pc 00000000005ea82f /src/out/host/linux-x86/lib64/libartd
.so (art::GetDalvikCache(char const*)+63)
native: art::GetAndroidData()
native: art/runtime/utils.cc:775
native: art::GetDalvikCache(char const*)
native: art/runtime/utils.cc:816
native: #07 pc 000000000033e693 /src/out/host/linux-x86/lib64/libartd
.so (art::gc::space::PruneDalvikCache(art::InstructionSet)+67)
native: art::gc::space::PruneDalvikCache(art::InstructionSet)
native: art/runtime/gc/space/image_space_fs.h:95
native: #08 pc 000000000033c5ef /src/out/host/linux-x86/lib64/libartd
.so (art::gc::space::ImageSpace::CreateBootImage(char const*, art::Instr
uctionSet, bool, std::__1::basic_string<char, std::__1::char_traits<char
>, std::__1::allocator<char>>*)+3935)
native: art::gc::space::ImageSpace::CreateBootImage(char const*, art
::InstructionSet, bool, std::__1::basic_string<char, std::__1::char_trai
ts<char>, std::__1::allocator<char> >*)
native: art/runtime/gc/space/image_space.cc:1610
My guess is that part of running dex2oat involves creating a boot image, and pruning the dalvik cache, but either someone up the line isn't setting ANDROID_DATA or the error recovery is messed up.
The issue had to do with some kind of bleed through into the docker container from the parent Ubuntu distribution. Going through the same process on Ubuntu 18.04, I was able to successfully build Android.