title: Linking External Libraries in Android Studio (gradle)
body: <p>I am using Android Studio. I added all the header files in the <code>jni</code>folder and also added the libraries in the <code>jniLibs</code> folder and also i added the path in the <code>build.gradle</code> file.</p>
  
  <pre><code>sourceSets.main {
  jni.srcDir 'src/main/jni'
  jniLibs.srcDir 'src/main/jniLibs'
  }
  </code></pre>
  
  <p>but I am getting <code>undefined reference error</code>. I searched on net and most solutions are to block automatic <code>ndk-build</code> call and edit the <code>Android.mk</code> file and then running <code>ndk-build</code> call from terminal. I want to link the external libraries in the <code>build.gradle</code> file. </p>
  
  <p>Secondly i am getting <code>undefined reference to 'std::ios_base::Init::Init()'</code> error. I linked the library</p>
  
  <pre><code>ldLibs "stdc++"
  </code></pre>
  
  <p>but still i am getting error. I am using cross compiled libraries and header files and i think i need to link the libraries provided by cross compiler. So i  did like this </p>
  
  <pre><code>ldLibs "/home/xx/xx/xx/xx/arm-linux-androideabi/lib/stdc++"
  </code></pre>
  
  <p>but still getting error. Any solution about it?</p>