How to solve "build/envsetup.sh LUNCH_MENU_CHOICES[@]: unbound variable" when trying to compile AOSP from source

curl https://storage.googleapis.com/git-repo-downloads/repo > repo
chmod a+x repo
./repo init -u https://android.googlesource.com/platform/manifest -b android-7.1.1_r6
./repo sync
. build/envsetup.sh

fails with:

build/envsetup.sh: line 508: LUNCH_MENU_CHOICES[@]: unbound variable

on Ubuntu 16.04.

Also mentioned at: https://bbs.archlinux.org/viewtopic.php?id=135180

Upvotes: 1

Views: 666

Answers (1)

On my .bashrc I had a:

set -u

Obviously envsetup.sh is not high quality enough to not have undefined variables or be a non sourced standalone script.

So either remove it, or add a:

set +u

to disable it.

You also likely want to get rid of:

set -e

but I haven't tested that.

Upvotes: 1

Related Questions