title: Android NDK Exception failed: dlopen failed: cannot locate symbol "_ZN7Tangram11setPositionEdd" referenced by "libtangram.so"
body: <p>I am trying to run a demo application of a <a href="https://github.com/tangrams/tangram-es" rel="nofollow noreferrer">Library</a> in which android ndk is integrated. I have imported <a href="https://github.com/tangrams/tangram-es/tree/master/android" rel="nofollow noreferrer">this</a> code in Android studio and also downloaded ndk and linked it with project. Code compiles and build succesfully. It gives crash with exception "exception ljava lang unsatisfiedlinkerror thrown while initializing" "failed: dlopen failed: cannot locate symbol "_ZN7Tangram11setPositionEdd" referenced by "libtangram.so"..."</p>
  
  <p>Application.mk:</p>
  
  <pre><code>APP_STL := c++_shared
  APP_CPPFLAGS := -frtti -fexceptions
  APP_ABI := armeabi armeabi-v7a x86 mips
  APP_PLATFORM := android-19
  </code></pre>
  
  <p>Android.mk:</p>
  
  <pre><code>LOCAL_PATH := $(call my-dir)
  include $(CLEAR_VARS)
  LOCAL_MODULE := tangram
  LOCAL_SRC_FILES := jniExports.cpp jniGenerated.cpp platform_android.cpp
  LOCAL_LDLIBS    := -llog
  LOCAL_ALLOW_UNDEFINED_SYMBOLS := true
  include $(BUILD_SHARED_LIBRARY)
  </code></pre>
  
  <p>Module Gradle File:</p>
  
  <pre><code>buildscript {
    dependencies {
      classpath 'com.android.tools.build:gradle:1.2.3'
      classpath 'com.github.dcendents:android-maven-plugin:1.2'
    }
  }
  
  apply plugin: 'com.android.library'
  apply plugin: 'com.github.dcendents.android-maven'
  
  group = GROUP
  version = VERSION_NAME
  
  android {
    compileSdkVersion 22
    buildToolsVersion "21.1.2"
  
    defaultConfig {
      minSdkVersion 15
      targetSdkVersion 22
   }
  
     sourceSets.main {
      manifest.srcFile 'AndroidManifest.xml'
      java.srcDirs = ['src']
      jni.srcDirs = []
      assets.srcDirs = ['core/resources']
    }
  
    task ndkBuild(type: Exec, description: 'Compile JNI source via NDK') {
          commandLine "C:/Users/Administrator/AppData/Local/Android/android-ndk-r10e/ndk-build.cmd",
          'NDK_PROJECT_PATH=build/intermediates/ndk',
          'NDK_LIBS_OUT=jniLibs',
          'APP_BUILD_SCRIPT=jni/Android.mk',
          'NDK_APPLICATION_MK=jni/Application.mk'
    }
    tasks.withType(JavaCompile) {
  compileTask -&gt; compileTask.dependsOn ndkBuild
    }
  }
  
  // Add gdb server to apk
  afterEvaluate {
      Sync packageTask =     project.getTasks().findByName("packageReleaseJniLibs")
          if (packageTask) { packageTask.include(['**/gdbserver',       '**/gdb.setup'])     }
  
      packageTask = project.getTasks().findByName("packageDebugJniLibs")
      if (packageTask) { packageTask.include(['**/gdbserver', '**/gdb.setup'])         }
      }
  
  dependencies {
    compile 'com.squareup.okhttp:okhttp:2.5.0'
    compile 'xmlpull:xmlpull:1.1.3.1'
  }
  
  apply from: file('gradle-mvn-push.gradle')
  </code></pre>
  
  <p>In Java class load libraries:</p>
  
  <pre><code>static {
          System.loadLibrary("c++_shared");
          System.loadLibrary("tangram");
      }
  </code></pre>
  
  <p>I google this issue and in these posts <a href="https://stackoverflow.com/questions/28740315/android-ndk-getting-java-lang-unsatisfiedlinkerror-dlopen-failed-cannot-loca">Link1</a> <a href="https://stackoverflow.com/questions/20698905/unsatisfiedlinkerror-in-android-4-4-libdevil-cannot-locate-symbol-png-set-longj">Link2</a> <a href="https://code.google.com/p/android/issues/detail?id=75302" rel="nofollow noreferrer">Link3</a> <a href="https://stackoverflow.com/questions/27338318/cannot-load-library-reloc-library1285-cannot-locate-rand">Link4</a> it is mentioned that it may be the issue of compiling at api 21 or newer and running it on older devices. But i have mentioend APP_PLATFORM := android-19 in my Application.mk and getting this exception.</p>
  
  <p>Any Help?</p>