Android Studio: Excluding Files from Compilation, build.gradle

Is it possible to exclude a folder from being built/compiled via the build.gradle file?

I have used the following statement so far:

sourceSets {
    main {
        jni.srcDirs = []
    }
}

This hides all of my jni folder source files within Android Studio. The files don’t get built - which is what I want because I want to manually build from a command prompt. But… I can’t see them in Android Studio and I would like to use Android Studio to manage/edit my source files.

Can somebody please tell me how I can make a folder of .cpp files show within Android Studio without them being built?

I am very new to Gradle so please bear with me.

I have also tried using the exclude command as follows but I get a DSL error:

sourceSets {
    main {
        exclude 'jni'
        //exclude ("jni/**")
        //jni.srcDirs = []
    }
}

Error:

Error:(10, 0) Gradle DSL method not found: 'exclude()'