title: Caused by: java.lang.NoSuchMethodError: No static method newFactory()
body: <p>I'm building an Android application and facing a no static method exception when trying to read the <strong>XLSX files</strong>. </p>
  
  <p>Tried all possibilities like updating dependencies in app/build.gradle, but no avail. </p>
  
  <p>Kindly help me to resolve this issue. </p>
  
  <pre><code>Exception causing line in code: XSSFWorkbook myWorkBook = new XSSFWorkbook(fis);
  
      08-07 12:37:05.828 16406-16511/droidmentor.tabwithviewpager E/AndroidRuntime: 
      FATAL EXCEPTION: AsyncTask #1
      Process: droidmentor.tabwithviewpager, PID: 16406
      java.lang.RuntimeException: An error occurred while executing doInBackground()
          at android.os.AsyncTask$3.done(AsyncTask.java:325)
          at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:354)
          at java.util.concurrent.FutureTask.setException(FutureTask.java:223)
          at java.util.concurrent.FutureTask.run(FutureTask.java:242)
          at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:243)
          at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
          at java.lang.Thread.run(Thread.java:761)
       Caused by: java.lang.NoSuchMethodError: No static method newFactory()Ljavax/xml/stream/XMLEventFactory; in class Ljavax/xml/stream/XMLEventFactory; or its super classes (declaration of 'javax.xml.stream.XMLEventFactory' appears in /data/app/droidmentor.tabwithviewpager-2/split_lib_dependencies_apk.apk)
          at org.apache.poi.openxml4j.opc.internal.marshallers.PackagePropertiesMarshaller.&lt;clinit&gt;(PackagePropertiesMarshaller.java:45)
          at org.apache.poi.openxml4j.opc.OPCPackage.init(OPCPackage.java:161)
          at org.apache.poi.openxml4j.opc.OPCPackage.&lt;init&gt;(OPCPackage.java:141)
          at org.apache.poi.openxml4j.opc.Package.&lt;init&gt;(Package.java:37)
          at org.apache.poi.openxml4j.opc.ZipPackage.&lt;init&gt;(ZipPackage.java:87)
          at org.apache.poi.openxml4j.opc.OPCPackage.open(OPCPackage.java:272)
          at org.apache.poi.util.PackageHelper.open(PackageHelper.java:37)
          at org.apache.poi.xssf.usermodel.XSSFWorkbook.&lt;init&gt;(XSSFWorkbook.java:254)
          at droidmentor.tabwithviewpager.Fragment.ChatFragment$LongOperation.readXLSX(ChatFragment.java:191)
          at droidmentor.tabwithviewpager.Fragment.ChatFragment$LongOperation.doInBackground(ChatFragment.java:112)
          at droidmentor.tabwithviewpager.Fragment.ChatFragment$LongOperation.doInBackground(ChatFragment.java:88)
          at android.os.AsyncTask$2.call(AsyncTask.java:305)
          at java.util.concurrent.FutureTask.run(FutureTask.java:237)
          at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:243) 
          at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133) 
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607) 
          at java.lang.Thread.run(Thread.java:761) 
  </code></pre>
  
  <p>I'm adding app.gradle file. The other codes are basic XLSX file reading using XSSF. When I tried to run this java snippet in Spring Suite Tool, it runs properly. However, When I integrate those java snippets into the Android app, it causing this runtime exception. </p>
  
  <p>App.Gradle:</p>
  
  <pre><code>apply plugin: 'com.android.application'
  
  android {
  compileSdkVersion 25
  buildToolsVersion '27.0.3'
  defaultConfig {
      applicationId "droidmentor.tabwithviewpager"
      minSdkVersion 15
      targetSdkVersion 25
      versionCode 1
      versionName "1.0"
      testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
  }
  buildTypes {
      release {
          minifyEnabled false
          proguardFiles getDefaultProguardFile('proguard-android.txt'), 
  'proguard-rules.pro'
      }
  }
  }
  
  apply plugin: 'android'
  
  repositories {
  mavenCentral()
  }
  
  
  
  dependencies {
  compile fileTree(include: ['*.jar'], dir: 'libs')
  androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
      exclude group: 'com.android.support', module: 'support-annotations'
  })
  //noinspection GradleCompatible
  compile 'com.android.support:appcompat-v7:25.0.0'
  //noinspection GradleCompatible
  compile 'com.android.support:design:25.0.+'
  compile 'org.apache.poi:poi:3.10-FINAL'
  compile 'net.sourceforge.jexcelapi:jxl:2.6.12'
  compile 'commons-io:commons-io:2.4'
  compile 'org.apache.poi:poi:3.11-beta2'
  compile 'org.apache.poi:poi-ooxml:3.11-beta2'
  compile 'javax.inject:javax.inject:1'
  compile 'javax.servlet:servlet-api:2.5'
  compile 'javax.servlet.jsp:jsp-api:2.1'
  compile 'javax.servlet:jstl:1.2'
  compile 'junit:junit:4.7'
  compile 'net.sf.opencsv:opencsv:2.3'
  compile 'org.apache.poi:poi-ooxml:2.3'
  compile 'org.apache.poi:poi-ooxml-schemas:3.8'
  compile 'org.apache.xmlbeans:xmlbeans:2.3.0'
  compile 'dom4j:dom4j:1.6.1'
  
  }
  </code></pre>