X09
X09

Reputation: 3956

How to repackage a dependency with Android Studio

I want to remove some duplicate classes from this library:

org.apache.tika:tika-parsers:1.14

How should I repackage it with Android Studio?

Edit

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

Upvotes: 0

Views: 709

Answers (2)

Distjoy
Distjoy

Reputation: 431

if you know the package name of the classes that has already been imported, just add this in the dependency section of app level gradle file

compile('org.apache.tika:tika-parsers:1.14'){
    exclude group: 'org.apache.xmlbeans'
}

Upvotes: 1

me_
me_

Reputation: 743

it really depends on how you plan to add it...

if you add it as an online repository you need to add the repository to the build.gradle file under the app folder and add it to the dependencies

otherwise as a project you can add it to the project folder and then to the dependencies and under the settings gradle add it as an include...

check out the pictures... you can see that i have several online repositories that i am drawing dependencies from and one that has been added as a project contained within the file system...

adding repositories to the online fetch with dependencies at the bottom

adding an included project as a dependency in the settings gradle

here paho has been added from an online respository and deckview from a project contained in the app file structure

Upvotes: 1

Related Questions