#if COMPILE_AOT || UNITY_IOS || UNITY_WSA || UNITY_WP8 || UNITY_WP8_1 || UNITY_WEBGL || UNITY_XBOXONE Not work on android with IL2CPP backend.
I understand, that it might be Unity problem, becouse COMPILE_AOT shoud be true, but I don't now how to write them, and they will be fix it for years.
I found only this solution
if (PlayerSettings.GetScriptingBackend(BuildTargetGroup.Android) == ScriptingImplementation.IL2CPP)
{
...
}