title: Apache Poi Android
body: <p>I am using <code>Apache Poi</code> in an Android application, but I have a problem with the <code>HSSFWorkbook</code>.</p>
  
  <p>I just want to read an Excel file found in the internal memory of the Android tablet. 
  (To display data in Android application)</p>
  
  <p>my code: </p>
  
  <pre><code>@Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
  
  
  
  try {
      AssetManager assetManager = this.getAssets();
      InputStream input = assetManager.open("test42.XLS");
  
      HSSFWorkbook classeur = new HSSFWorkbook(input);
  
      //HSSFSheet feuille = classeur.getSheetAt(0);
  
      //Cell cell = feuille.getRow(1).getCell(1);
  
      //String value = cell.getStringCellValue();
  
      TextView tv = new TextView(this);
  
  
      tv.setText("Test");
  
      setContentView(tv);
  
  } catch (IOException e) {
      e.printStackTrace();
      System.out.println("prob");
  
  }
  
  }
  </code></pre>
  
  <p>The log :</p>
  
  <pre><code>01-28 14:09:55.036: E/dalvikvm(6919): Could not find class 'org.apache.xmlbeans.XmlOptions', referenced from method org.apache.poi.POIXMLDocumentPart.&lt;clinit&gt;
  
  01-28 14:09:55.036: W/dalvikvm(6919): VFY: unable to resolve new-instance 2751 (Lorg/apache/xmlbeans/XmlOptions;) in Lorg/apache/poi/POIXMLDocumentPart;
  
  01-28 14:09:55.036: D/dalvikvm(6919): VFY: replacing opcode 0x22 at 0x0008
  
  01-28 14:09:55.056: E/AndroidRuntime(6919): FATAL EXCEPTION: main
  
  01-28 14:09:55.056: E/AndroidRuntime(6919): java.lang.ExceptionInInitializerError
  
  01-28 14:09:55.056: E/AndroidRuntime(6919):     at org.apache.poi.ss.usermodel.WorkbookFactory.create(WorkbookFactory.java:72)
  
  01-28 14:09:55.056: E/AndroidRuntime(6919):     at android.app.Activity.performCreate(Activity.java:5267)
  
  01-28 14:09:55.056: E/AndroidRuntime(6919):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1097)
  
  01-28 14:09:55.056: E/AndroidRuntime(6919):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2209)
  
  01-28 14:09:55.056: E/AndroidRuntime(6919):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2295)
  
  01-28 14:09:55.056: E/AndroidRuntime(6919):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1280)
  
  01-28 14:09:55.056: E/AndroidRuntime(6919):     at java.lang.reflect.Method.invokeNative(Native Method)
  </code></pre>
  
  <p>the new log cat :</p>
  
  <pre><code>01-29 10:00:44.809: I/dalvikvm(7833): Could not find method org.apache.commons.codec.digest.DigestUtils.md5, referenced from method org.apache.poi.hssf.usermodel.HSSFWorkbook.addPicture
  
  01-29 10:00:44.809: W/dalvikvm(7833): VFY: unable to resolve static method 6355: Lorg/apache/commons/codec/digest/DigestUtils;.md5 ([B)[B
  
  01-29 10:00:44.809: D/dalvikvm(7833): VFY: replacing opcode 0x71 at 0x0004
  
  01-29 10:00:44.829: W/System.err(7833): java.io.IOException: Invalid header signature; read 0x0010000000060409, expected 0xE11AB1A1E011CFD0
  
  01-29 10:00:44.829: W/System.err(7833):     at org.apache.poi.poifs.storage.HeaderBlock.&lt;init&gt;(HeaderBlock.java:140)
  
  01-29 10:00:44.829: W/System.err(7833):     at org.apache.poi.poifs.storage.HeaderBlock.&lt;init&gt;(HeaderBlock.java:104)
  
  01-29 10:00:44.829: W/System.err(7833):     at 
  
  org.apache.poi.poifs.filesystem.POIFSFileSystem.&lt;init&gt;(POIFSFileSystem.java:138)
  01-29 10:00:44.829: W/System.err(7833):     at 
  
  
  org.apache.poi.hssf.usermodel.HSSFWorkbook.&lt;init&gt;(HSSFWorkbook.java:322)
  01-29 10:00:44.829: W/System.err(7833):     at 
  
  org.apache.poi.hssf.usermodel.HSSFWorkbook.&lt;init&gt;(HSSFWorkbook.java:303)
  
  01-29 10:00:44.829: W/System.err(7833):     at com.example.test.MainActivity.onCreate(MainActivity.java:41)
  
  01-29 10:00:44.829: W/System.err(7833):     at android.app.Activity.performCreate(Activity.java:5267)
  
  01-29 10:00:44.829: W/System.err(7833):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1097)
  
  
  01-29 10:00:44.829: W/System.err(7833):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2209)
  
  01-29 10:00:44.829: W/System.err(7833):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2295)
  
  01-29 10:00:44.829: W/System.err(7833):     at android.app.ActivityThread.access$700(ActivityThread.java:150)
  
  
  01-29 10:00:44.829: W/System.err(7833):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1280)
  
  01-29 10:00:44.829: W/System.err(7833):     at android.os.Handler.dispatchMessage(Handler.java:99)
  
  01-29 10:00:44.829: W/System.err(7833):     at 
  android.os.Looper.loop(Looper.java:176)
  
  01-29 10:00:44.829: W/System.err(7833):     at android.app.ActivityThread.main(ActivityThread.java:5279)
  
  01-29 10:00:44.829: W/System.err(7833):     at java.lang.reflect.Method.invokeNative(Native Method)
  
  01-29 10:00:44.829: W/System.err(7833):     at java.lang.reflect.Method.invoke(Method.java:511)
  
  
  01-29 10:00:44.829: W/System.err(7833):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102)
  
  01-29 10:00:44.829: W/System.err(7833):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869)
  
  01-29 10:00:44.829: W/System.err(7833):     at dalvik.system.NativeStart.main(Native Method)
  
  
  01-29 10:00:44.899: W/ResourceType(7833): Failure getting entry for 0x01080a03 (t=7 e=2563) in package 0 (error -75)
  
  01-29 10:00:44.999: D/libEGL(7833): loaded /vendor/lib/egl/libEGL_POWERVR_SGX544_115.so
  
  01-29 10:00:45.049: D/libEGL(7833): loaded /vendor/lib/egl/libGLESv1_CM_POWERVR_SGX544_115.so
  
  01-29 10:00:45.059: D/libEGL(7833): loaded /vendor/lib/egl/libGLESv2_POWERVR_SGX544_115.so
  
  01-29 10:00:45.129: D/OpenGLRenderer(7833): Enabling debug mode 0
  </code></pre>