将kSOAP依赖项添加到Gradle项目 [英] Adding kSOAP dependency to Gradle project

查看:707
本文介绍了将kSOAP依赖项添加到Gradle项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



这是我的项目的build.gradle文件:

  buildscript {
repositories {
mavenCentral()
}
依赖关系{
classpath'com。 android.tools.build:gradle:0.5.+'
}
}
apply plugin:'android'

repositories {
mavenCentral()

maven {
url'http://ksoap2-android.googlecode.com/svn/m2-repo'
}
}

android {
compileSdkVersion 18
buildToolsVersion18.0.1

defaultConfig {
minSdkVersion 7
targetSdkVersion 18
}
}

依赖关系{
编译'com.android.support:support-v4:18.0.0'
编译'ch.acra:acra:4.5.0'
编译'com.google.guava:guava:12.0'
编译'com.google.code.ksoap2-android:ksoap2-android:3.0.0'
}

库似乎包含在项目中并且编译能够工作,但是当我尝试导入类时(即SoapObject),它似乎甚至不存在命名空间。有趣的是,其他库(如ACRA或番石榴)工作正常。我怎么能解决这个问题?

解决方案

这让我有点想弄清楚,但我终于得到它的工作。我一直在研究一个解析KSoap的WSDL解析器,并且最终得到了这个工作只是为了通过Gradle与ksoap的导入进行战斗。

  apply plugin:'android-library'

buildscript {
repositories {
mavenCentral()
maven {url'https://oss.sonatype.org/content/repositories/ksoap2-android-releases/'}
}
依赖项{
classpath'com.android.tools.build:gradle:0.8.+'
classpath'com.google.code.ksoap2-android:ksoap2-android:3.1.1'
}
}

知识库{
maven {url'https://oss.sonatype.org/content/repositories/ksoap2-android-releases/'}
}


android {
compileSdkVersion 19
buildToolsVersion19.0.1

defaultConfig {
minSdkVersion 15
targetSdkVersion 19
versionCode 1
versionName1.0
}
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt '),'p roguard-rules.txt'
}
}

依赖关系{

编译'com.google.code.ksoap2-android:ksoap2-android: 3.1.1'

}

当然,我的服务库是一个服务库,所以你可能想使用apply插件:'android'。
希望这有助于并节省一些时间。


I'm trying to make kSOAP working in my Android project with Gradle.

This is my project's build.gradle file:

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.5.+'
    }
}
apply plugin: 'android'

repositories {
    mavenCentral()

    maven {
        url 'http://ksoap2-android.googlecode.com/svn/m2-repo'
    }
}

android {
    compileSdkVersion 18
    buildToolsVersion "18.0.1"

    defaultConfig {
        minSdkVersion 7
        targetSdkVersion 18
    }
}

dependencies {
    compile 'com.android.support:support-v4:18.0.0'
    compile 'ch.acra:acra:4.5.0'
    compile 'com.google.guava:guava:12.0'
    compile 'com.google.code.ksoap2-android:ksoap2-android:3.0.0'
}

The library seems to be included in the project and compilation DOES work but when I try to import a class (ie SoapObject) it seems like the namespace does not even exist. The funny thing is that the other libraries (such as ACRA or Guava) are working fine. How can I solve this problem?

解决方案

This took me a bit to figure out as well, but I have finally gotten it working. I've been working on a WSDL parser that parses for KSoap and finally got that working only to fight through Gradle with the import of ksoap. At anyrate here is how you do it.

apply plugin: 'android-library'

buildscript {
    repositories {
        mavenCentral()
        maven { url 'https://oss.sonatype.org/content/repositories/ksoap2-android-releases/' }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.8.+'
        classpath 'com.google.code.ksoap2-android:ksoap2-android:3.1.1'
    }
}

repositories {
    maven { url 'https://oss.sonatype.org/content/repositories/ksoap2-android-releases/' }
}


android {
    compileSdkVersion 19
    buildToolsVersion "19.0.1"

    defaultConfig {
        minSdkVersion 15
        targetSdkVersion 19
        versionCode 1
        versionName "1.0"
    }
    release {
        runProguard false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
    }
}

dependencies {

    compile 'com.google.code.ksoap2-android:ksoap2-android:3.1.1'

}

Of course mine is a service library, so you may want to use apply plugin: 'android'. Hopefully this helps and saves somebody some time.

这篇关于将kSOAP依赖项添加到Gradle项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆