Mohit Gaur Mohit Gaur - 1 month ago 37
Android Question

Getting compilation error when using Refrofit simple xml converter

I am a beginner in android and xmpp, i am developing a chat application using xmpp as protocol and openfire as server.I am using xmpp rest api to create a group.To create a group i need to send GET request to server with xml data body..I am using retrofit2 in android client.Whenever i am building my application it is giving me this error



rror:warning: Ignoring InnerClasses attribute for an anonymous inner class
Error:($1) that doesn't come with an
Error:associated EnclosingMethod attribute. This class was probably produced by a
Error:compiler that did not target the modern .class file format. The recommended
Error:solution is to recompile the class from source, using an up-to-date compiler
Error:and without specifying any "-target" type options. The consequence of ignoring
Error:this warning is that reflective operations on this class will incorrectly
Error:indicate that it is *not* an inner class.
Error:trouble processing "javax/xml/XMLConstants.class":
Error:Ill-advised or mistaken usage of a core class (java.* or javax.*)
Error:when not building a core library.
Error:This is often due to inadvertently including a core library file
Error:in your application's project, when using an IDE (such as
Error:Eclipse). If you are sure you're not intentionally defining a
Error:core class, then this is the most likely explanation of what's
Error:going on.
Error:However, you might actually be trying to define a class in a core
Error:namespace, the source of which you may have taken, for example,
Error:from a non-Android virtual machine project. This will most
Error:assuredly not work. At a minimum, it jeopardizes the
Error:compatibility of your app with future versions of the platform.
Error:It is also often of questionable legality.
Error:If you really intend to build a core library -- which is only
Error:appropriate as part of creating a full virtual machine
Error:distribution, as opposed to compiling an application -- then use
Error:the "--core-library" option to suppress this error message.
Error:If you go ahead and use "--core-library" but are in fact
Error:building an application, then be forewarned that your application
Error:will still fail to build or run, at some point. Please be
Error:prepared for angry customers who find, for example, that your
Error:application ceases to function once they upgrade their operating
Error:system. You will be to blame for this problem.
Error:If you are legitimately using some code that happens to be in a
Error:core package, then the easiest safe alternative you have is to
Error:repackage that code. That is, move the classes in question into
Error:your own package namespace. This means that they will never be in
Error:conflict with core system classes. JarJar is a tool that may help
Error:you in this endeavor. If you find that you cannot do this, then
Error:that is an indication that the path you are on will ultimately
Error:lead to pain, suffering, grief, and lamentation.
Error:1 error; aborting
:app:transformClassesWithDexForDebug FAILED
Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
> java.lang.RuntimeException: java.util.concurrent.ExecutionException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_05\bin\java.exe'' finished with non-zero exit value 1

This is my retrofit code below

Call<Void> createGroup(@Header("Accept") String content_type,
@Header("Authorization") String authorization,
@Body Group group);


public static int doCreateGroup(String content_type, String authorization, Group group) {
Retrofit retrofit = new Retrofit.Builder().baseUrl(StaticVariables.base_url)
.client(new OkHttpClient())
Alfa alfa = retrofit.create(Alfa.class);
Call<Void> call = alfa.createGroup(content_type, authorization, group);
try {
Response<Void> response = call.execute();
Log.e("Group Upi", String.valueOf(response.code()));
return response.code();
} catch (IOException e) {
return 0;


Below is my model of group

@Root(name = "group")
public class Group {
@Element(name = "name")
public String name;

@Element(name = "description")
public String description;

public Group(String name,String description){


Below is the actual xml which i have to send

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<description>Some description</description>

Below is my dependencies

compile ''
compile ''
compile ''
compile ''
compile 'org.igniterealtime.smack:smack-android:4.1.4'
compile 'org.igniterealtime.smack:smack-tcp:4.1.4'
compile 'org.igniterealtime.smack:smack-im:4.1.4'
compile 'org.igniterealtime.smack:smack-extensions:4.1.4'
compile 'com.squareup.retrofit2:retrofit:2.1.0'
compile 'com.squareup.retrofit2:converter-gson:2.1.0'
compile 'com.squareup.okhttp3:logging-interceptor:3.2.0'
compile ''
compile 'com.squareup.retrofit2:converter-simplexml:2.1.0'
compile('') {
transitive = true;

Please tell me where i am wrong


The error is because of some classes in simple xml converter.So we just need to remove some classes,The solution is,just add below lines in gradle compile dependency

compile ('com.squareup.retrofit2:converter-simplexml:2.1.0') {
        exclude group: 'xpp3', module: 'xpp3'
        exclude group: 'stax', module: 'stax-api'
        exclude group: 'stax', module: 'stax'