If you have calls to AssetDatabase or other editor code in non-editor-only scripts, you need to wrap them like this:
#if UNITY_EDITOR
// code here that should only exist in the editor
#endif
In addition, you can make your code do different things if it’s in Play Mode or Edit Mode. So for example…
void DoStuff()
{
#if UNITY_EDITOR
if (Application.isPlaying)
{
// code to run if in Play Mode
} else {
// code to run if in Edit Mode
}
#else
// code to run if in a build
#endif
}
And you can make it for example do this in WebGL, that in Android or something else otherwise…
#if UNITY_WEBGL
// code when WebGL platform
#elif UNITY_ANDROID
// code when Android platform
#else
// code when Windows, Mac, whatever
#endif
And you can combine stuff like this too:
#if WEBGL && !UNITY_EDITOR
// stuff when WebGL but NOT in the editor (i.e. only when running in a build in a web browser)
#endif
Finally, any Editor-only scripts should always be placed in /Editor/ folders, i.e. Assets/Whatever/Editor/MyCustomEditor.cs
Are all packages resolved? Have you built the addressables data? These things may be stopping you from building as well as what @adamgolden has mentioned.