title: Add .so (prebuilt) library from another directory to APK
body: <p>I am trying to include my .so library from another directory. Compiling my project works fine. But when I run it, it gives me </p>
  
  <blockquote>
    <p>java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.company.gimikapp-2/base.apk"],nativeLibraryDirectories=[/data/app/com.company.gimikapp-2/lib/arm, /vendor/lib, /system/lib]]] couldn't find "libtheprebuiltlib.so"</p>
  </blockquote>
  
  <p>Common solutions I see in SO is this:</p>
  
  <pre><code>sourceSets {
      main {
          jniLibs.srcDirs = ['src/main/jniLibs']
      }
  }
  </code></pre>
  
  <p>Tried both </p>
  
  <pre><code>jniLibs.srcDirs = ['C:\\svn\\sys_libs']
  </code></pre>
  
  <p>and</p>
  
  <pre><code>jniLibs.srcDirs = ['C:/svn/sys_libs']
  </code></pre>
  
  <p>How do you actually point it to another directory outside your Android project?</p>
  
  <p>This is my CMakeList.txt:</p>
  
  <pre><code>cmake_minimum_required(VERSION 3.4.1)
  add_library( native-lib
              SHARED
              src/main/cpp/source/native-lib.cpp )
  add_library(theprebuiltlib SHARED IMPORTED)
  set_target_properties(theprebuiltlib PROPERTIES IMPORTED_LOCATION
              C:/svn/sys_libs/libtheprebuiltlib.so)
  target_include_directories(
              native-lib PRIVATE
              src/main/cpp/source/
              C:/svn/sys_includes/)
  find_library( log-lib
              log)
  target_link_libraries( native-lib
              theprebuiltlib
              ${log-lib})
  </code></pre>
  
  <p>And here is my gradle setup for my JNI:</p>
  
  <pre><code>android {
      ...
      defaultConfig {
          ...
          externalNativeBuild {
              cmake {
                  cppFlags "-frtti -fexceptions"
              }
              ndk {
                  abiFilters 'armeabi'
              }
          }
          ...
      }
      ...
      externalNativeBuild {
          cmake {
              path "CMakeLists.txt"
          }
      }
      sourceSets {
          main {
              jniLibs.srcDirs = ['C:/svn/sys_libs']
          }
      }
  }
  </code></pre>