2017-02-19 85 views
2

我正在嘗試使用Apache tika解析某些文檔,但它給了我很多錯誤和警告。如何在Android上使用Apache Tika

的build.gradle

dependencies { 
    ... 
    compile ('org.apache.tika:tika-parsers:1.14'){ 
     exclude group: 'org.json', module: 'json' 
     exclude group: 'commons-logging', module: 'commons-logging' 
     exclude group: 'org.apache.httpcomponents', module: 'httpclient'} 
... 
} 

爲了使這個問題更容易閱讀,我不會在這裏貼上警告(他們是600+),我會忽略他們,但這些錯誤是這些:

Error:Uncaught translation error: java.lang.IllegalArgumentException: already added: Lorg/apache/xmlbeans/xml/stream/Location; 
Error:Uncaught translation error: java.lang.IllegalArgumentException: already added: Lorg/apache/xmlbeans/xml/stream/ReferenceResolver; 
Error:Uncaught translation error: java.lang.IllegalArgumentException: already added: Lorg/apache/xmlbeans/xml/stream/XMLEvent; 
Error:Uncaught translation error: java.lang.IllegalArgumentException: already added: Lorg/apache/xmlbeans/xml/stream/XMLInputStream; 
Error:Uncaught translation error: java.lang.IllegalArgumentException: already added: Lorg/apache/xmlbeans/xml/stream/XMLName; 
Error:Uncaught translation error: java.lang.IllegalArgumentException: already added: Lorg/apache/xmlbeans/xml/stream/XMLStreamException; 
Error:Uncaught translation error: java.lang.IllegalArgumentException: already added: Lorg/apache/xmlbeans/xml/stream/utils/NestedThrowable; 
Error:Uncaught translation error: java.lang.IllegalArgumentException: already added: Lorg/apache/xmlbeans/xml/stream/utils/NestedThrowable$Util; 
Error:8 errors; aborting 
Error:Execution failed for task ':app:transformClassesWithDexForDebug'. 
> com.android.build.api.transform.TransformException: java.lang.RuntimeException: java.lang.RuntimeException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: Return code 1 for dex process 
Information:BUILD FAILED 

請問你有沒有解決這個問題。或者更好的是,你知道一個更好的庫,我可以用它來提取文檔的元數據嗎?

+0

您是否找到解決方案?如果是,請在答案中張貼。 –

+0

@AnujaKothekar不,我沒有找到解決方案。 – X09

回答

2

試着用這個,它爲我工作。

compile group: 'org.apache.tika', name: 'tika-parsers', version: '1.14' 
相關問題