title: Calling method inside .so shared library on android studio
body: <p>I need some help to use the method &quot;callMethod()&quot; inside &quot;.so&quot; (shared library) in android studio.</p>
  <p>My android studio version is 2.1.3.</p>
  <p>I created jniLibs folder in &quot;src/main/&quot;.
  Then I created three folders inside jniLibs folder: (armeabi, armeabi-v7a, x86).
  Then I put the .so library inside every mentioned folder.
  After that, I updated the build.gradle as follows:</p>
  <pre><code>compile fileTree(dir: 'libs', include: ['*.jar','.so'])
  </code></pre>
  <p>In the MainActivity java class I wrote this:</p>
  <pre><code>static {
          System.loadLibrary(&quot;SharedLibAndroid&quot;);
      }
  </code></pre>
  <p>After that I don't know what should I do.</p>
  <p>How do I call the method <code>callMethod()</code> from the .so library?</p>
  <p>I searched a lot but I did't see full example how to do that.</p>
  <p>I've added to my project new class and native method like below:</p>
  <pre><code>@SuppressWarnings(&quot;JniMissingFunction&quot;)
  public class Test1Cpp {
  static {
      System.loadLibrary(&quot;Cpp&quot;);
  }
  
  public native String callMethod();
  }
  </code></pre>
  <p>Then I can call the method inside .so shared library.</p>
  <p>I faced another problem, which is my .so library didn't work with all platform mobiles.</p>
  <p>The error is:</p>
  <blockquote>
  <p>java.lang.UnsatisfiedLinkError: dlopen failed:
  &quot;/data/app/com.mysecondtestapp-1/lib/arm/libCpp.so&quot; has
  unexpected e_machine: 3</p>
  </blockquote>
  <p>So, how to convert my .so library to work on all platform mobiles?</p>