The type or namespace name 'AndroidExternalToolsSettings' does not exist in the namespace

I’m trying to get the NDK install path in a Unity post build script, and the documentation says that UnityEditor.Android.AndroidExternalToolsSettings should provide that. But it cannot be found. The Android Build Support is installed, but it cannot be found.

The interface mentioned in the UnityEditor.Android namespace is available but the two classes are not – what am I missing?

This happens in 2019.4.32f1, is there any help on this issue? In my case it is related to a certain package (com.google.android.appbundle@1.5.0) and if I delete it from my package cache, the problem seems to disappear until next restart.