Android Common Errors

From Variscite Wiki
VAR-SOM-MX6 - N7.1.1 - Common errors

Code fetch errors

These errors might occur when a repo sync command is unable to fetch the code from the repo manifest.
Output example:

Fetching project platform/external/linux-tools-perf
remote: Finding sources: 100% (1812/1812)
error: RPC failed; result=56, HTTP code = 200 625.00 KiB/s      
fatal: The remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed
error: RPC failed; result=56, HTTP code = 200
fatal: The remote end hung up unexpectedly
error: RPC failed; result=56, HTTP code = 200
fatal: The remote end hung up unexpectedly
fatal: early EOF
fatal: early EOF
fatal: index-pack failed
fatal: index-pack failed
error: RPC failed; result=56, HTTP code = 0
fatal: The remote end hung up unexpectedly
remote: Counting objects: 194, done
remote: Finding sources: 100% (194/194)
remote: Total 194 (delta 5), reused 171 (delta 5)
Receiving objects: 100% (194/194), 2.47 MiB | 1.79 MiB/s, done.
Resolving deltas: 100% (5/5), done.

And Fetching projects:  99% (450/454)  Fetching project platform/packages/wallpapers/MagicSmoke
remote: Counting objects: 192, done
remote: Finding sources: 100% (192/192)
error: Cannot fetch platform/external/libeditMiB | 1.67 MiB/s   
warn: --force-broken, continuing to sync
remote: Total 192 (delta 33), reused 138 (delta 33)
Receiving objects: 100% (192/192), 282.68 KiB | 53.00 KiB/s, done.
Resolving deltas: 100% (33/33), done.

How to fix these errors:

  • Make sure you are not behind a firewall that is blocking your access to the relevant repositories (if needed, contact your IT administrator about this).
  • If you want to use a proxy you should set the following environment variables before running the repo command:
$ export HTTP_PROXY=http://<proxy_user_id>:<proxy_password>@<proxy_server>:<proxy_port>
$ export HTTPS_PROXY=http://<proxy_user_id>:<proxy_password>@<proxy_server>:<proxy_port>

More rarely, Linux clients experience connectivity issues, getting stuck in the middle of downloads (typically during "Receiving objects"). It has been reported that tweaking the settings of the TCP/IP stack and using non-parallel commands can improve the situation. You need root access to modify the TCP setting:

$ sudo sysctl -w net.ipv4.tcp_window_scaling=0
$ repo sync -j1
  • Make sure you have sufficient free space available on your machine before you start any repo sync
  • Make sure you have initialized the host machine build environment is initialized correctly.
  • At the end of the code sync, it will ask for sudo password to clone the CLANG compiler,

This is a huge repository and requires sudo access with your root filesystem or (/opt/) mount point to have at least 40 GB free space available.

Build Errors

Jack Server Errors or Out of memory errors

Usually, jack server errors are common starting from Android 7.1.1 onwards, if not sufficient RAM memory or ownership of the jack server is controlled by other users/jack server use.
Refer to to jack documentation to understand why JACK server exists.

Common jack errors or out of memory errors

FAILED: out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/with-local/classes.dex 
/bin/bash out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/with-local/classes.dex.rsp
Out of memory error (version 1.3-rc7 'Douarn' (445000 d7be3910514558d6715ce455ce0861ae2f56925a by
GC overhead limit exceeded.
Try increasing heap size with java option '-Xmx<size>'.
Warning: This may have produced partial or corrupted output.
[ 83% 53958/64361] //external/llvm/lib/Transforms/Vectorize:libLLVMVectorize clang++ Vectorize.cpp
[ 83% 53959/64361] //external/llvm/lib/Transforms/Vectorize:libLLVMVectorize clang++ LoadStoreVectorizer.cpp
external/llvm/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp:527:56: warning: lambda capture 'LI' is not used [-Wunused-lambda-capture]
      if (isa<VectorType>(Ty) && !all_of(LI->users(), [LI](const User *U) {
external/llvm/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp:560:56: warning: lambda capture 'SI' is not used [-Wunused-lambda-capture]
      if (isa<VectorType>(Ty) && !all_of(SI->users(), [SI](const User *U) {
2 warnings generated.
[ 83% 53960/64361] //external/llvm/lib/Transforms/Vectorize:libLLVMVectorize clang++ BBVectorize.cpp
ninja: build stopped: subcommand failed.
13:31:48 ninja failed with: exit status 1
build/core/ recipe for target 'run_soong_ui' failed
make: *** [run_soong_ui] Error 1
  • Fix:

Try increasing your swap space or increase your maximum RAM available in your system keeping 1 GB for your system to work properly. We recommend you have at least 16GB and 32 GB swap space.

Otherwise, you will end up in such a situation.
Assuming you have 16 GB of RAM below are the commands you can run before starting compilation.
Please don't clean the system, it will take more time again to compile it.

$export JACK_SERVER_VM_ARGUMENTS="-Dfile.encoding=UTF-8 -XX:+TieredCompilation -Xmx15000m"
$out/host/linux-x86/bin/jack-admin kill-server
$out/host/linux-x86/bin/jack-admin start-server

And restart the build.

Multiple user jack errors

Jack server runs system-wide only once, so if you have multiple users building android, make sure no previous build was running and no other jack servers are running. To verify run

$ ps -afx | grep "jack-server"
 612 pts/11   S+     0:00                      \_ grep --color=auto jack-server
27543 pts/10   Sl     8:48 java -XX:MaxJavaStackTraceDepth=-1 -Dfile.encoding=UTF-8 -XX:+TieredCompilation -Xmx15000m -cp /home/user/.jack-server/launcher.jar
  • Fix:

If you see the process like that kill it, as the only tired compilation by the only single user is allowed.

$ sudo kill -9 27543 

Note: In the above case 27543 is PID of the jackserver running as an example. And then restart the build normally

Flex Errors

FAILED: out/target/product/xxx/obj/STATIC_LIBRARIES/libedify_intermediates/lexer.cpp 
/bin/bash -c "prebuilts/misc/linux-x86/flex/flex-2.5.39 -oout/target/product/xxx/obj/STATIC_LIBRARIES/libedify_intermediates/lexer.cpp bootable/recovery/edify/lexer.ll"
flex-2.5.39: loadlocale.c:130: _nl_intern_locale_data: Assertion `cnt < (sizeof (_nl_value_type_LC_TIME) / sizeof (_nl_value_type_LC_TIME[0]))' failed.
Aborted (core dumped)

If you encounter above flex assert errors or building on Ubuntu 18.04 with older Flex version from prebuilt, this is highly likely you will encounter above error. Please use below command to export env variable

$ export LC_ALL=C

And restart the build.


  • Where - xxx can be your product which you are building android images for

libncurses5 Errors

If you encounter

prebuilts/clang/host/linux-x86/clang-3289846/bin/clang.real: error while loading shared libraries: cannot open shared object file: No such file or directory

This means the libncurses5 is not installed properly. Please install it via

  • FIX:
 sudo apt-get install lib32ncurses5-dev libncurses5-dev 

This should fix the errors

Pahole errors

If you encounter

BTF: .tmp_vmlinux.btf: pahole (pahole) is not available
Failed to generate BTF for vmlinux


 sudo apt install dwarves 

Getting Support on Your build failures

If you are facing build issues questions/details register a ticket to our online portal
at Variscite Customer Portal with the following details in the ticket:

  • The platform you are trying to compile Android images
  • The release version you are trying to compile
  • The Host Machine Details, mention clearly which type of machine you are using, physical or virtual or AWS or other cloud build server providers
  • The RAM and storage space left after you downloaded the code
  • The step in the build process where it failed
  • Attach the full build1-1.log
  • Steps to reproduce the error