title: Using Prebuilt library in Android Studio
body: <p>I'm making a jni Function in android to generate file checkSum using BoringSSL.</p>
  
  <p>So I built boringssl to shared Library for use Prebuilt Library in Android studio.</p>
  
  <p>The build output like this.
  <a href="https://i.stack.imgur.com/x8UZ8.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/x8UZ8.png" alt="enter image description here"></a></p>
  
  <p>I copied the *.so file to my project src/main/jniLibs/lib 
  and BoringSSL include folder to src/main/jni</p>
  
  <p>I referenced this project and apply to my projects.</p>
  
  <p><a href="https://github.com/googlesamples/android-ndk/tree/master/hello-libs" rel="nofollow noreferrer">https://github.com/googlesamples/android-ndk/tree/master/hello-libs</a></p>
  
  <p>My <strong>build.gradle</strong> file like this.
  I'm using gradle-experimental:0.7.0( and Window10, Android Studio 2.1.2 )</p>
  
  <pre><code>apply plugin: 'com.android.model.application'
  
  model {
      repositories {
          libs(PrebuiltLibraries) {
              boringssl {
                  headers.srcDir "src/main/jni/include/openssl"
  
                  binaries.withType(SharedLibraryBinary) {
                      sharedLibraryFile = file("src/main/jniLibs/lib/libcrypto.so")
                      sharedLibraryFile = file("src/main/jniLibs/lib/libssl.so")
                  }
              }
          }
      }
      android {
          compileSdkVersion = 24
          buildToolsVersion = '24.0.1'
  
          defaultConfig {
              applicationId = 'yein.a'
              minSdkVersion.apiLevel = 19
              targetSdkVersion.apiLevel = 24
              versionCode = 1
              versionName = '1.0'
          }
          ndk {
              moduleName = 'hello-libs'
              ldLibs.addAll(['android', 'log'])
          }
          sources {
              main {
                  jni {
                      dependencies {
                          library 'boringssl' linkage 'shared'
                      }
                  }
                  jniLibs{
                      source{
                          srcDir "src/main/jniLibs/lib"
                      }
                  }
              }
          }
          productFlavors{
              create("arm"){
                  ndk.abiFilters.add("armeabi-v7a")
              }
          }
          buildTypes {
              release {
                  minifyEnabled false
                  proguardFiles.add(file('proguard-android.txt'))
              }
          }
      }
  }
  
  dependencies {
      compile fileTree(dir: 'libs', include: ['*.jar'])
      compile 'com.android.support:appcompat-v7:24.1.1'
  }
  </code></pre>
  
  <p>This is my project structure.</p>
  
  <p><a href="https://i.stack.imgur.com/jJvLo.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/jJvLo.png" alt="enter image description here"></a></p>
  
  <p>I think I properly apply the example projects, because it is not occurred gradle sync error. </p>
  
  <p>And when I use MD5 function Android Studio auto complete function name like this.
  <a href="https://i.stack.imgur.com/RZfUb.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/RZfUb.png" alt="enter image description here"></a></p>
  
  <p>But I click run it occurred error like this...
  <a href="https://i.stack.imgur.com/lAmH7.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/lAmH7.png" alt="enter image description here"></a></p>
  
  <p>I searched a lot project in google,github, and of course stackoverflow previous answers but I still not solve my problem.</p>
  
  <p>I tried change gradle version but other gradle version occurred error in auto generated jni function except gradle-experimental:0.7.0.</p>
  
  <p>Could anyone point me in the right direction or even a solution?</p>
  
  <p>Thanks for read my Question.</p>