title: Creating and using Java Bindings library for PocketSphinxAndroidDemo
body: <p>I want to create a Java Bindings library for the <a href="http://cmusphinx.sourceforge.net/wiki/tutorialandroid" rel="nofollow">PocketSphinx Android Demo project</a> for Xamarin, that I can then use in my Android application. I have done the following:</p>
  
  <ul>
  <li>downloaded the PocketSphinxAndroidDemo project, and installed and run it on my Android device using Eclipse without any issues - the native java code works nicely.</li>
  <li>created a Java Bindings library in Visual Studio with the pocketsphinx-android-0.8-nolib.jar file marked as an EmbeddedJar and marked Copy to output directory always and got this to compile fine. I'm using the jar from the downloaded demo project.</li>
  <li>added an android application project to my Visual Studio solution and added a reference to my bindings library.</li>
  <li>added lib/armeabi/libpocketsphinx_jni.so to my application project (also armeabi-v7a) (using the files from the demo project) and marked the *.so files as AndroidNativeLibrary with Copy to Output directory set to Copy Always.</li>
  </ul>
  
  <p>No matter what I do I can't run the line of C# code</p>
  
  <p><code>var config = Decoder.DefaultConfig();</code> </p>
  
  <p>I always get a <code>Java.Lang.UnsatisfiedLinkError</code> exception (<a href="http://forums.xamarin.com/discussion/15121/java-bindings-library-project-for-pocketsphinx-with-so#latest" rel="nofollow">as described in my forum post here</a>). I'm trying to run this line of code because the demo project has this line of java:</p>
  
  <p><code>Config config = defaultConfig();</code></p>
  
  <p>My question is, do I need to use <code>DllImport</code> here? Or perhaps <code>Java.Lang.JavaSystem.LoadLibrary</code>? Is this a scenario where the project should be built using ndk-build?</p>
  
  <p>I have tried both DllImport and LoadLibrary with no success. Any leads or things to try much appreciated!</p>
  
  <p>Thanks in advance,</p>
  
  <p>David</p>