question: @ Nullable private CompileScope createFacetsCompileScope ( @ NotNull final CompilerManager compilerManager , @ NotNull final VirtualFile [ ] files ) { final Set < Module > modules = New . set ( ) ; boolean facetsFound = false ; for ( final VirtualFile file : files ) { final Module module = ModuleUtilCore . findModuleForFile ( file , project ) ; if ( module != null ) { modules . add ( module ) ; if ( ! facetsFound ) { facetsFound = hasFacets ( module ) ; } } } if ( facetsFound ) { return compilerManager . createModulesCompileScope ( modules . toArray ( Module . EMPTY_ARRAY ) , true , true ) ; } return null ; }
target:  It seems that createFilesCompileScope does not work in all environments, at least with Android, see https://intellij-support.jetbrains.com/hc/en-us/community/posts/207521525-CompilerManager-make-does-not-all-tasks-in-case-of-a-Android-module-project <p> We choose a very defensive solution and use createModulesCompileScope when we detect a facet.