knuxify's scrap

lineage os is broken

knuxify's Android Build Error Troubleshooting Guide

This document is always a work-in-progress. Also, I reccomend you bookmark it, just in case.

This ISN'T a building tutorial. Go consult xda-developers if you need one.
This is a site for unlucky people like me who have problems that nobody else ever had, and cannot find an answer.
You'll find ugly fixes, tips for fixing builds and some logs of errors I've encountered.
I am in no way a proffesional, merely a noob in the ROM building scene. Keep that in mind.

The Rules

Always remember to:
1. repo sync --force-sync.
2. Can't sync? repo diff and remove all changes by hand.
3. Only remove out if you think it will really help. Try troubleshooting first.
4. Make a virtualenv with python2.

General fixes

NOTE: I will NOT take ANY responsibility for broken builds, loud neighbors, global warming caused by overheating building machines or demons haunting your ROMs.


Useless java files not compiling?

Replace them with a "Hello world" script and try again. (This can be destructive, so keep that as a last resort)

Some classes/variables missing?

Try searching for them in other files (grep -iR "phrase"), they may have been moved. If this doesn't work, see 'The Missing Files' below.

SElinux/SEpolicy errors?

This usually happens when porting trees from one version to another. Set SEpolicy to permissive and rewrite it. The official Android security docs have some useful information about writing SEPolicies.

Syntax errors?

Fix them manually.

Removed something in a repository and now you can't resync?

Remove the folder and redownload it with git.

Specific fixes

Getting "x contains class file y which is not in the whitelist" errors?

Add ".*" to the end of the build/core/tasks/check_boot_jars/package_whitelist.txt file. This renders the entire whitelist useless as it will match all classes.

Getting errors from libmcldScript_intermediates/ScriptScanner.cpp"?

This happened to me while building LineageOS 14, but it seems like it happens on older versions too. To solve this, I replaced framework/compile/mclinker with the version from LineageOS 16. I also replaced the prebuilt flex with a slightly newer version, but I doubt that actually changed anything. People also reported simmilar errors with locales that aren't set to C, so try export=LC_ALL=C if nothing works.

flex-related errors(namely flex-2.5.39: loadlocale.c:131: _nl_intern_locale_data: Assertion `cnt < (sizeof (_nl_value_type_LC_COLLATE) / sizeof (_nl_value_type_LC_COLLATE[0]))' failed.)

Seems to be solved by the following commands:
export LANG=""
sudo rm /usr/lib/locale/locale-archive
# add LC_COLLATE=en_US.UTF-8 to /etc/locale.conf, if it's not there yet
sudo locale-gen

Taken from this post.

jack running out of memory

Add JACK_SERVER_VM_ARGUMENTS="-Dfile.encoding=UTF-8 -XX:+TieredCompilation -Xmx4096m" to your ~/.jack-settings. Taken from this blogpost.

The Missing Files (and other things)

Very often you might be missing files or classes in your device config, especially when porting a device to a newer version of Android. The best way to solve this is to find another device using a simmilar or the same chipset, or simply search for the file on the internet, and compare it with your version, then add any changes that are necesarry.