title: Android studio 1.3 NDK cannot resolve c++ header / code
body: <p>I'm quite new using Android Studio 1.3.2 and even more using the NDK.
  I'm trying to using OpenCV 2.4.11 and C++.
  I'm using Gradle 2.6.</p>
  
  <p>So far and oddly OpenCV doesn't generate any errors in the C++ code. Just When I'm including C++ headers like  or , it cannot resolve them. Same goes for Try...Catch that are unresolved.
  Again, I started using Android Studio like 2 weeks ago and NDK 1 week ago. I'm still not sure what I'm doing.</p>
  
  <pre><code>#include "jni.h"
  #include &lt;vector&gt;
  #include &lt;string&gt;
  #include &lt;opencv2/contrib/contrib.hpp&gt;
  
  #ifdef __cplusplus
  extern "C" {
  #endif
  
  JNIEXPORT jlong JNICALL Java_face_rt_facert_FisherFaceRecognizer_createFisherFaceRecognizer_10(JNIEnv *env,
                                                                           jclass type) {
  
  try {
      cv::Ptr&lt;cv::FaceRecognizer&gt; pfr = cv::createFisherFaceRecognizer();
      pfr.addref(); // this is for the 2.4 branch, 3.0 would need a different treatment here
      return (jlong) pfr.obj;
       } catch (...) {
      jclass je = env-&gt;FindClass("java/lang/Exception");
      env-&gt;ThrowNew(je, "sorry, dave..");
      }
      return 0;
  }
  
  #ifdef __cplusplus
  }
  #endif
  </code></pre>
  
  <p>My build.gradle file for the project:</p>
  
  <pre><code>apply plugin: 'com.android.model.application'
  
  model {
  android {
      compileSdkVersion = 23
      buildToolsVersion = "23.0.1"
  
      defaultConfig.with {
          applicationId = "face.rt.facert"
          minSdkVersion.apiLevel = 19
          targetSdkVersion.apiLevel = 19
          versionCode = 1
          versionName = "1.0.1"
      }
  
  }
  
  android.buildTypes {
      release {
          minifyEnabled = false
          proguardFiles += file('proguard-rules.txt')
      }
  }
  
  android.ndk { // keeping it to make AS correctly support C++ code editing and debugging
      moduleName = "Face"
      ldLibs += ['log']
      cppFlags += "-std=c++11"
      cppFlags += "-fexceptions"
      cppFlags += "-I${file("src/main/jni/prebuilts/include")}".toString()
      cppFlags  += "-I${file("C:/Android-dev/SDKs/OpenCV-android-sdk/sdk/native/jni/include")}".toString()
      cppFlags  += "-I${file("C:/Android-dev/SDKs/OpenCV-android-sdk/sdk/native/jni/include/opencv")}".toString()
      cppFlags  += "-I${file("C:/Android-dev/SDKs/OpenCV-android-sdk/sdk/native/jni/include/opencv2")}".toString()
      stl = "gnustl_shared" //"stlport_static"
  }
  
  
  android.productFlavors {
      // for detailed abiFilter descriptions, refer to "Supported ABIs" @
      // https://developer.android.com/ndk/guides/abis.html#sa
      create("arm") {
          ndk.with {
              abiFilters += "armeabi"
  
              File curDir = file('./')
              curDir = file(curDir.absolutePath)
              String libsDir = curDir.absolutePath+"\\src\\main\\jniLibs\\armeabi\\" //"-L" +
  
              ldLibs += libsDir + "libnative_camera_r4.3.0.so"
              ldLibs += libsDir + "libopencv_contrib.a"
              ldLibs += libsDir + "libopencv_core.a"
              ldLibs += libsDir + "libopencv_highgui.a"
              ldLibs += libsDir + "libopencv_imgproc.a"
              ldLibs += libsDir + "libopencv_info.so"
              ldLibs += libsDir + "libopencv_java.so"
              ldLibs += libsDir + "libopencv_legacy.a"
              ldLibs += libsDir + "libopencv_ml.a"
              ldLibs += libsDir + "libopencv_ts.a"
  
          }
      }
      create("armv7") {
          ndk.with {
              abiFilters += "armeabi-v7a"
  
              File curDir = file('./')
              curDir = file(curDir.absolutePath)
              String libsDir = curDir.absolutePath+"\\src\\main\\jniLibs\\armeabi-v7a\\" //"-L" +
  
              ldLibs += libsDir + "libnative_camera_r4.3.0.so"
              ldLibs += libsDir + "libopencv_contrib.a"
              ldLibs += libsDir + "libopencv_core.a"
              ldLibs += libsDir + "libopencv_highgui.a"
              ldLibs += libsDir + "libopencv_imgproc.a"
              ldLibs += libsDir + "libopencv_info.so"
              ldLibs += libsDir + "libopencv_java.so"
              ldLibs += libsDir + "libopencv_legacy.a"
              ldLibs += libsDir + "libopencv_ml.a"
              ldLibs += libsDir + "libopencv_ts.a"
  
          }
      }
      create("x86") {
          ndk.with {
              abiFilters += "x86"
          }
      }
      create("mips") {
          ndk.with {
              abiFilters += "mips"
          }
      }
      create("fat") {
  
      }
  
      // To include all cpu architectures, leaves abiFilters empty
      create("all")
  }
  }
  
  dependencies {
      compile fileTree(include: ['*.jar'], dir: 'libs')
      compile 'com.android.support:appcompat-v7:23.0.1'
      compile project(':openCVLibrary2411')
  }
  </code></pre>
  
  <p>And this is my dependencies in my project:</p>
  
  <pre><code>classpath 'com.android.tools.build:gradle-experimental:0.3.0-alpha3'
  </code></pre>
  
  <p>EDIT:</p>
  
  <p>Removed Try...Catch from the function for testing purpose.
  Oddly, vector and string headers are now resolved and working.</p>
  
  <p>But now I'm getting few errors about OpenCV at the compile time.</p>
  
  <blockquote>
    <p>Error:(16) undefined reference to `cv::createFisherFaceRecognizer(int, double)'</p>
    
    <p>Error:(2607) undefined reference to `cv::fastFree(void*)'</p>
    
    <p>Error:Execution failed for task ':app:linkArm64-v8aDebugAllFaceSharedLibrary'.
    A build operation failed.
          Linker failed while linking libFace.so.</p>
  </blockquote>