Could not find method externalNativeBuild() for arguments
<p>i'm trying to integrate the ndkBuild functionality into an existing android studio project, using the new android studio 2.2 , in order to enable c++ debugging etc.
i have tried out one of the ndk example projects which android studio 2.2 offers, which works perfectly fine. However, when i try to run the gradle commands in my own project, i get this error message:</p>

<p><em>Error:(73, 0) Could not find method externalNativeBuild() for arguments [build_c6heui1f67l8o1c3ifgpntw6$_run_closure2$_closure9@4329c1c9] on project  ':core' of type org.gradle.api.Project.</em> </p>

<p>By following this description 
<a href="http://tools.android.com/tech-docs/external-c-builds">http://tools.android.com/tech-docs/external-c-builds</a>
i ended up with a gradle script which includes the following commands:</p>

<pre><code>externalNativeBuild{
    ndkBuild{
        path "$projectDir/jni/Android.mk"
    }
}

externalNativeBuild {
    ndkBuild {
      arguments "NDK_APPLICATION_MK:=$projectDir/jni/Application.mk"
      abiFilters "armeabi-v7a", "armeabi","arm64-v8a","x86"
      cppFlags "-frtti -fexceptions"
    }
}
</code></pre>

<p>Did i perhaps miss out on something here with the project setup?
I have set the <strong>Android NDK location</strong> properly under </p>

<p><em>File -> Project Structure ... -> SDK Location  -> Android NDK location</em></p>

<p>in my android studio. </p>

<p>Anything else i might have forgotton?</p>

<p>Has anyone run into a similar problem before?</p>

<p>Advice would be much appreciated =)</p>