2015-07-31 9 views
23

Ich versuche, XML Java-Objekt-Wandler in Retrofit zu integrieren, indem Sie diese https://futurestud.io/blog/retrofit-how-to-integrate-xml-converter/in build.gradle für die Nachrüstung

Ich erhalte Fehler bauen, wenn ich Abhängigkeit zu meinem Build hinzugefügt .groß.

Dies ist, was ich in meinem build.gradle hinzugefügt habe. Kompilierung ('com.squareup.retrofit: Wandler-simplexml: 1.9.0')

Fehlerbericht:

Information:Gradle tasks [:app:assembleDebug] 
Warning:Dependency xpp3:xpp3:1.1.3.3 is ignored for debug as it may be conflicting with the internal version provided by Android. 
In case of problem, please repackage it with jarjar to change the class packages 
Warning:Dependency xpp3:xpp3:1.1.3.3 is ignored for release as it may be conflicting with the internal version provided by Android. 
In case of problem, please repackage it with jarjar to change the class packages 

SO habe ich versucht, diesen

compile ('com.squareup.retrofit:converter-simplexml:1.9.0') { 
exclude group: 'xpp3', module: 'xpp3' 
} 

Fehlerbericht mit dies:

trouble processing "javax/xml/stream/events/StartElement.class": 
Ill-advised or mistaken usage of a core class (java.* or javax.*) 
.... 
... 
Error:Execution failed for task ':app:preDexDebug'. 
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.7.0_75.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1 

Ich habe versucht, Gradle sauber, bauen alles sauber, aber nutzlos. Hilf mir, wenn du eine Idee hast.

Antwort

78

Ich könnte es lösen. Ich musste die folgenden transitiven Abhängigkeiten ausschließen: stax: stax-api, stax: stax.

compile ('com.squareup.retrofit:converter-simplexml:1.9.0') { 
    exclude group: 'xpp3', module: 'xpp3' 
    exclude group: 'stax', module: 'stax-api' 
    exclude group: 'stax', module: 'stax' 
} 

Vielen Dank!

UPDATE: Same fix für retrofit2 auch

compile ('com.squareup.retrofit2:converter-simplexml:2.0.0-beta3'){ 
    exclude group: 'xpp3', module: 'xpp3' 
    exclude group: 'stax', module: 'stax-api' 
    exclude group: 'stax', module: 'stax' 
} 
+0

Wie ich kompilieren bin mit 'com.squareup.retrofit2: Konverter-simplexml: 2.1.0' – Prasad

+1

Sie die Legende sind! – Kaushal28

+1

seine Arbeit für Version 2.2.0 – wanz

7

Es ist auch mit 2.0.0-beta3 arbeiten.

// Retrofit XML convertidor 
compile ('com.squareup.retrofit2:converter-simplexml:2.0.0-beta3'){ 
    exclude group: 'xpp3', module: 'xpp3' 
    exclude group: 'stax', module: 'stax-api' 
    exclude group: 'stax', module: 'stax' 
} 
Verwandte Themen