How to exclude source files in Android Studio?

Hi, I would like to exclude source files in Android Studio without having to delete the files.

I tried to do it in build.gradle but I couldn’t figure out how to do it.
Here’s what I did.

    jni {
            source {
                srcDirs= appSrcDirs(ofRoot())

                includes = srcIncludes(ofRoot())
                excludes = srcExcludes(ofRoot())

But it doesn’t work.

I googled and tried everything I could but no luck.
I would appreciate any advice. Thanks.