title: OpenCV in new Android Studio NDK
body: <p>I am trying to create NDK application dependent on OpenCV with new experimental gradle plugin in Android Studio but I can't really setup my <code>build.gradle</code> correctly.</p>
  
  <p>My NDK setup in <code>build.gradle</code> looks like this:</p>
  
  <pre><code>/*
   * native build settings
   */
  android.ndk {
      moduleName = "nonfree_jni"
      stl = "gnustl_static"
      cppFlags += "-I${opencv_path}".toString()    
  }
  </code></pre>
  
  <p>where <code>opencv_path</code> is path to my OpenCV Android SDK (include directory)</p>
  
  <p>If I open my <code>.cpp</code> file, the OpenCV classes and files are properly colored and everything looks OK but when I try to build project a lot of "undefined reference: cv::something" occurs.</p>
  
  <p>I did not find any tutorial to run OpenCV in Android Studio (only that with manual ndk-build command) and don't really know how to fix this. Some stackoverflow post said that this errors happens when I don't point to <code>OpenCV.mk</code> in my <code>Android.mk</code> configuration but I obviously don't have this option. </p>
  
  <p>Any ideas?</p>