2013-08-06 11 views
54

के साथ SimpleXML का उपयोग करना मुझे SimpleXML का उपयोग करके ग्रैडल 0.5 और + एंड्रॉइड स्टूडियो के साथ एंड्रॉइड एप्लिकेशन को संकलित करने का प्रयास करने में परेशानी हो रही है।एंड्रॉइड और ग्रैडल

Gradle: Execution failed for task ':MyApplication:dexDebug'. 
> Failed to run command: 
    /Applications/Android Studio.app/sdk/build-tools/android-4.2.2/dx --dex --output <REALLY_LONG_STRING.....> 
    Error Code: 
    1 
    Output: 
    trouble processing "javax/xml/stream/events/StartElement.class": 
    Ill-advised or mistaken usage of a core class (java.* or javax.*) 
    when not building a core library. 
    This is often due to inadvertently including a core library file 
    in your application's project, when using an IDE (such as 
    Eclipse). If you are sure you're not intentionally defining a 
    core class, then this is the most likely explanation of what's 
    going on. 
    However, you might actually be trying to define a class in a core 
    namespace, the source of which you may have taken, for example, 
    from a non-Android virtual machine project. This will most 
    assuredly not work. At a minimum, it jeopardizes the 
    compatibility of your app with future versions of the platform. 
    It is also often of questionable legality. 
    If you really intend to build a core library -- which is only 
    appropriate as part of creating a full virtual machine 
    distribution, as opposed to compiling an application -- then use 
    the "--core-library" option to suppress this error message. 
    If you go ahead and use "--core-library" but are in fact 
    building an application, then be forewarned that your application 
    will still fail to build or run, at some point. Please be 
    prepared for angry customers who find, for example, that your 
    application ceases to function once they upgrade their operating 
    system. You will be to blame for this problem. 
    If you are legitimately using some code that happens to be in a 
    core package, then the easiest safe alternative you have is to 
    repackage that code. That is, move the classes in question into 
    your own package namespace. This means that they will never be in 
    conflict with core system classes. JarJar is a tool that may help 
    you in this endeavor. If you find that you cannot do this, then 
    that is an indication that the path you are on will ultimately 
    lead to pain, suffering, grief, and lamentation. 
    1 error; aborting 

build.gradle इस तरह कॉन्फ़िगर किया गया है:

dependencies { 
    [...] 
    compile 'org.simpleframework:simple-xml:2.7.+' 
} 
repositories { 
    [...] 
    mavenCentral() 
} 

मैं इस समस्या को कैसे हल कर सकते हैं

यह त्रुटि है? अगर मैं libs के अंदर एक जार के रूप में सीधे सरल-एक्सएमएल स्थापित

संपादित समस्या मौजूद नहीं है/- निश्चित रूप से एक Maven समाधान क्लीनर होगा।

उत्तर

125

आपको स्टैक्स-एपीआई को भी बाहर करने की आवश्यकता है। अगर पिछले समाधान काम नहीं करता है

compile('org.simpleframework:simple-xml:2.7.+'){ 
    exclude module: 'stax' 
    exclude module: 'stax-api' 
    exclude module: 'xpp3' 
} 
+2

हाय Juggeli,, यह आसान-एक्सएमएल से इन 3 मॉड्यूल को छोड़कर समस्या का समाधान नहीं करता है की तरह लगता है। लिंट अभी भी इस तथ्य के साथ रो रही है कि यह एक गैर-एंड्रॉइड लाइब्रेरी है। कोई भी इस मुद्दे का सामना कर रहा है? – Alex

+0

यदि आप एकल उद्धरण के चारों ओर अभिभावक नहीं डालते हैं, तो आपको पहले घुंघराले ब्रेस से पहले कॉमा की आवश्यकता होगी अन्यथा आपको "त्रुटि: (70, 0) विधि नहीं मिल सका com.squareup.retrofit2: कनवर्टर-सरल xml: 2.1.0 () तर्क के लिए .... "। मुझे यकीन नहीं है कि माता-पिता के बीच क्या अंतर है या नहीं ... लेकिन इसमें भाग गया और पता लगाने में थोड़ी देर लग गई। – mawalker

4

मुझे लगता है कि आपको कुछ निर्भरताओं को बाहर करने की आवश्यकता है।

compile('org.simpleframework:simple-xml:2.7.+'){ 
    exclude module: 'stax' 
    exclude module: 'xpp3' 
} 
14

इस प्रयास करें:

configurations { 
    compile.exclude module: 'stax' 
    compile.exclude module: 'stax-api' 
    compile.exclude module: 'xpp3' 
} 
dependencies { 
    [...] 
    compile 'org.simpleframework:simple-xml:2.7.+' 
} 
repositories { 
    [...] 
    mavenCentral() 
} 
+0

कुछ कारणों से, संकलन कथन पर खंडों को बाहर करने का उपयोग नहीं किया गया था, लेकिन कॉन्फ़िगरेशन में उन्हें सूचीबद्ध करने के लिए मेरे लिए किया गया था। –

0

मैं SimpleFramework का उपयोग करते समय एक ही त्रुटि हो रही है। असल में मैं इसे build.gradle में इन पंक्तियों को जोड़ने के द्वारा समाधान किया गया: नई Gradle संस्करण के साथ

compile('org.simpleframework:simple-xml:2.7.1') 
{ 
    exclude group: 'stax', module: 'stax-api' 
    exclude group: 'xpp3', module: 'xpp3'<br> 
} 
संबंधित मुद्दे