title: how to extract 7z file android studio
body: <p>I'm writing an Android application that need to extract 7z archives.Pressed for time,I've searching of third-party libraries or source code which can be used in my project.</p>
  
  <p>i copy .so file in /libs folder</p>
  
  <blockquote>
    <p>app\src\main\jniLibs\armeabi\libun7z.so</p>
  </blockquote>
  
  <p>i cant extract 7z file in android</p>
  
  <blockquote>
    <p>AndUn7z.extract7z(My7z, My7zPath);</p>
  </blockquote>
  
  <p>after run this line i have this error : </p>
  
  <blockquote>
    <p>java.lang.UnsatisfiedLinkError: No implementation found for int com.darkgamers.pepsiman.browser.mainmenu.AndUn7z.un7zip(java.lang.String, java.lang.String) (tried Java_com_darkgamers_pepsiman_browser_mainmenu_AndUn7z_un7zip and Java_com_darkgamers_pepsiman_browser_mainmenu_AndUn7z_un7zip__Ljava_lang_String_2Ljava_lang_String_2)
                                                                         at com.darkgamers.pepsiman.browser.mainmenu.AndUn7z.un7zip(Native Method)</p>
  </blockquote>
  
  <p>this is my code :</p>
  
  <pre><code>public class AndUn7z {
  
  public static boolean extract7z(String filePath, String outPath)
  {
      File outDir = new File(outPath);
      if(!outDir.exists() || !outDir.isDirectory())
      {
          outDir.mkdirs();
      }
      return (AndUn7z.un7zip(filePath, outPath) == 1);
  }
  
  /**
   * Extract from assets
   * @param context
   * @param assetPath
   * @param outPath
   * @return
   * @throws Exception
   */
  public static boolean extractAssets(Context context, String assetPath, String outPath)
  {
      File outDir = new File(outPath);
      if(!outDir.exists() || !outDir.isDirectory())
      {
          outDir.mkdirs();
      }
  
      String tempPath = outPath + File.separator + ".temp";
      try {
          copyFromAssets(context, assetPath, tempPath);
      } catch (Exception e) {
          e.printStackTrace();
          return false;
      }
      boolean ret = (AndUn7z.un7zip(tempPath, outPath) == 1);
      new File(tempPath).delete();
  
      return ret;
  }
  
  /**
   * Copy asset to temp
   * @param context
   * @param assetPath
   * @param tempPath
   * @throws Exception
   */
  private static void copyFromAssets(Context context, String assetPath, String tempPath)
          throws Exception
  {
      InputStream inputStream = context.getAssets().open(assetPath);
      FileOutputStream fileOutputStream = new FileOutputStream(tempPath);
      int length = -1;
      byte[] buffer = new byte[0x400000];
      while ((length = inputStream.read(buffer)) != -1) {
          fileOutputStream.write(buffer, 0, length);
      }
      fileOutputStream.flush();
      fileOutputStream.close();
      inputStream.close();
  }
  
  //JNI interface
  private static native int un7zip(String filePath, String outPath);
  
  static {
      System.loadLibrary("un7z");
  }
  </code></pre>
  
  <p>}</p>