Android Common Errors
Code Fetch Errors
Build Errors
Jack Server 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 https://source.android.com/setup/build/jack#using_jack to jack documentation to understand why JACK server exists.
Common jack 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 android-jack-team@google.com)). 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/main.mk:21: 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. https://stackoverflow.com/questions/35579646/android-source-code-compile-error-try-increasing-heap-size-with-java-option
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