2

I am using the experimental gradle plugin with Gradle 2.5 and AS 1.4; I have the following in my build.gradle file

android.sources {
        main {
            jni {
                source {
                    srcDirs += "src/main/jni"
                    srcDirs += "${fooRoot}/fooFolder"
                }
            }
        }
    }

What happens is all the contents of fooFolder become children of the src/main/jni folder. Is there a way to specify a destination folder so they become children of say src/main/jni/fooFolderDestination for eg?

Harkish
  • 2,262
  • 3
  • 22
  • 31

1 Answers1

0

The short answer is 'no'. It is frustrating that two source directories are mixed together when you use "Android" view of your project. A possible workaround is to define one of the directories as the jni.srcDir for a library module.

Another workaround is to use

jni.srcDir += "${fooRoot}"

but hen if you have more CPP files under it, AndroidStudio will want to compile them, too. This can be avoided by using hybrid Android.mk + grade plugin approach as demonstrated for define LOCAL_SRC_FILES in ndk{} DSL.

Community
  • 1
  • 1
Alex Cohn
  • 56,089
  • 9
  • 113
  • 307