android - 带有 gradle 的 android 的 xml spring

标签 android xml spring rest

您好,我在整个 Internet 上进行了搜索,但我没有发现 new SimpleXmlHttpMessageConverter() 的任何依赖项,我在 pom.xml 文件中将它与 maven 一起使用。我可以和grandle一起使用吗?

我的pom是

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>org.hello</groupId>
    <artifactId>gs-consuming-rest-xml-android</artifactId>
    <version>0.1.0</version>
    <packaging>apk</packaging>
    <name>gs-consuming-rest-xml-android</name>

    <dependencies>
        <dependency>
            <groupId>com.google.android</groupId>
            <artifactId>android</artifactId>
            <version>4.1.1.4</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.android</groupId>
            <artifactId>spring-android-rest-template</artifactId>
            <version>1.0.1.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.simpleframework</groupId>
            <artifactId>simple-xml</artifactId>
            <version>2.7</version>
            <exclusions>
                <exclusion>
                    <artifactId>stax</artifactId>
                    <groupId>stax</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>stax-api</artifactId>
                    <groupId>stax</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>xpp3</artifactId>
                    <groupId>xpp3</groupId>
                </exclusion>
            </exclusions>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>com.jayway.maven.plugins.android.generation2</groupId>
                <artifactId>android-maven-plugin</artifactId>
                <version>3.8.2</version>
                <configuration>
                    <sdk>
                        <platform>19</platform>
                    </sdk>
                    <deleteConflictingFiles>true</deleteConflictingFiles>
                    <undeployBeforeDeploy>true</undeployBeforeDeploy>
                </configuration>
                <extensions>true</extensions>
            </plugin>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.1</version>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                </configuration>
            </plugin>
        </plugins>
    </build>

</project>

在 gradle 中我尝试使用:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 20
    buildToolsVersion "20.0.0"

    defaultConfig {
        applicationId "com.example.georgiadis.weatherfirstrest"
        minSdkVersion 8
        targetSdkVersion 20
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            runProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    packagingOptions {
        exclude 'META-INF/ASL2.0'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/license.txt'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/notice.txt'
    }
}

    dependencies {
        compile 'com.android.support:appcompat-v7:20.0.0'
        compile 'org.springframework.android:spring-android-rest-template:1.0.1.RELEASE'
        compile 'org.simpleframework:simple-xml:2.7.1'
    }

当我构建时,我采取:

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

最佳答案

将最后一行改为

编译 'com.hannesdorfmann:httpkit-simple-xml:1.5.0'

它对我有用。原因是你的simple-xml jar版本太高

关于android - 带有 gradle 的 android 的 xml spring,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26443942/

相关文章:

android - 媒体播放器不工作

Java获取对象变量名和获取内部对象变量名

java - 如何在android中导入XmlAccessorType

python - 奥杜 8 : How can I send context to python method?

spring - 如何在 Spring 身份验证成功处理程序方法中访问原始 HttpServletRequest 对象?

Spring 3.0 与 Java EE 6.0

java - Mybatis 嵌套集合不能正确使用列前缀

android - Android 应用程序中的互联网权限问题?

android - 无法读取未定义的属性 'latitude'

c# - 如何在 ASP.net 页面中设置面包屑