Android 使用Refrofit simple xml转换器时出现编译错误
我是android和xmpp的初学者,我正在开发一个聊天应用程序,使用xmpp作为协议和openfire作为服务器。我正在使用xmpp rest api创建一个组。要创建一个组,我需要使用xml数据体向服务器发送GET请求。我在android客户端中使用Reformation2。每当我构建我的应用程序时,它都会给我这个错误 错误: E 下面是我的改装代码Android 使用Refrofit simple xml转换器时出现编译错误,android,xmpp,retrofit,openfire,Android,Xmpp,Retrofit,Openfire,我是android和xmpp的初学者,我正在开发一个聊天应用程序,使用xmpp作为协议和openfire作为服务器。我正在使用xmpp rest api创建一个组。要创建一个组,我需要使用xml数据体向服务器发送GET请求。我在android客户端中使用Reformation2。每当我构建我的应用程序时,它都会给我这个错误 错误: E 下面是我的改装代码 @GET("/plugins/restapi/v1/groups") Call<Void> createGroup
@GET("/plugins/restapi/v1/groups")
Call<Void> createGroup(@Header("Accept") String content_type,
@Header("Authorization") String authorization,
@Body Group group);
下面是我必须发送的实际xml
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<group>
<name>GroupName</name>
<description>Some description</description>
</group>
请告诉我哪里错了这个错误是由于简单xml转换器中的一些类造成的。所以我们只需要删除一些类,解决方案是,只需在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'
}
@Root(name = "group")
public class Group {
@Element(name = "name")
public String name;
@Element(name = "description")
public String description;
public Group(String name,String description){
this.description=description;
this.name=name;
}
}
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<group>
<name>GroupName</name>
<description>Some description</description>
</group>
compile 'com.google.android.gms:play-services:9.4.0'
compile 'com.google.firebase:firebase-core:9.4.0'
compile 'com.android.support:cardview-v7:23.2.0'
compile 'com.android.support:recyclerview-v7:23.2.0'
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 'com.google.code.gson:gson:2.6.2'
compile 'com.squareup.retrofit2:converter-simplexml:2.1.0'
compile('com.digits.sdk.android:digits:1.10.3@aar') {
transitive = true;
}
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'
}