Android Studio: Adding a tree of files that you don't want to build/compile

  • Replies:0
  • Answered
Paul Spark
  • Forum posts: 2

May 17, 2016, 11:45:36 AM via Website

Hi. I am using Android Studio and I am using it to run a manually built NDK project. I build my NDK source (.cpp files) from the command line ('Terminal' on the Mac) and I have the following Gradle statement which prevents my JNI files from appearing within Android Studio itself:

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

This is something that I've done because I've been following a really useful tutorial (sorry - new user and I'm not allowed to post a link). However, what I would like to do is be able to see my C++ source files within Android Studio without it actually trying to compile them.

Does anybody know how to do this? I would like a folder of some sort under the project showing my files but have them excluded from the build process. I have the feeling that I may be able to use an 'exclude' statement in the build.gradle file to stop them from being built.

Any ideas?

I want to continue to compile from the command line until such time that Android Studio fully supports NDK.

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()'

— modified on May 17, 2016, 12:14:14 PM

Reply