Generating native headers?

First, sorry for the double post; I posted this question in a rather old and resolved thread and realized that, for this forum, that may not be a good idea.

In 2.2.1, I ran into a JNI problem with some previously working JNI examples ( https://github.com/bbarker/gradle-examples ). The following line:

jniPlatformCExtractHeaders.dependsOn nativeHeaders

results in:

  • What went wrong: A problem occurred evaluating root project ‘gradle-examples’. > Could not find property ‘jniPlatformCExtractHeaders’ on project ‘:jvm:jni’.

I verified the build worked in the 2.0 gradle wrapper script. In 2.2.1, it appears that the headers are not building put in to $buildDir/nativerHeaders, which is where they should be going, so I assume that is what jniPlatformCExtractHeaders is doing (running javah). How to do this in 2.2.1?

Also, I can’t seem to find any JNI examples in the existing repository. Having one or more maintained JNI examples in gradle might be a big help. Sorry if I’m looking in the wrong place!

Fixed now, I removed the offending line and added

tasks.withType(CCompile) {task -> task.dependsOn nativeHeaders}