Reputation: 8857
I'm using Android Studio 1.2.2 and just downloaded 1.3RC3, as it reputedly has full NDK support.
I have a working project while my .c / .h files remain in app/src/main/jni
; however, I want them in AndroidProject/../common/src
, i.e. outside the android project folder. How do I make this work?
To reiterate: this question is about EXTERNAL, NATIVE CODE; not importing external java!
Upvotes: 1
Views: 525
Reputation: 8857
This was so simple, I didn't think to even try it at first, but it worked at once:
android{
...
sourceSets.main.jni.srcDirs = ['../../common/test']
...
}
...which implies that the path is relative to AndroidProject/app
.
A problem with this solution is that it is incompatible with a standalone Android.mk
, since preventing Android.mk
generation by gradle requires sourceSets.main.jni.srcDirs = []
.
Upvotes: 2