Adding kSOAP dependency to Gradle project

后端 未结 8 695
梦毁少年i
梦毁少年i 2020-12-24 13:43

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

This is my project\'s build.gradle file:

buildscript {
    repositories {
               


        
相关标签:
8条回答
  • 2020-12-24 13:49

    I am using @amitav13's solution but the URL of the repository has changed:

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

    Current version as of now is 3.6.0

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

    This did work for me.

    0 讨论(0)
  • 2020-12-24 13:52

    I was in the same situation. And I gave up to add that jar from mavencentral.

    I added the raw jar as a lib.

    1. Download the latest (or whatever version) of ksoap2-android from this url
    2. Call it in the build.gradle, see below

    Here is the code:

    dependencies {
       compile files('libs/ksoap2-android.jar')
    }
    

    I hope it will help.

    0 讨论(0)
  • 2020-12-24 13:52

    More simple solution is just download the .jar from http://www.bvbcode.com/code/ed5zc936-1814251-down and add this .jar file to your libs folder.

    Finally in your build.gradle:

    dependencies {
        compile fileTree(include: ['*.jar'], dir: 'libs') 
    }
    

    This worked fine for me.

    0 讨论(0)
  • 2020-12-24 13:53
    repositories {
        maven { url 'https://oss.sonatype.org/content/repositories/ksoap2-android-releases/' }
    }
    

    and inside Dependencies

    compile 'com.google.code.ksoap2-android:ksoap2-android:3.6.1'
    
    0 讨论(0)
  • 2020-12-24 13:54

    I know there are already answers using a jar file. I wanted to add one with the latest updated links:

    Download ksoap2-android-assembly-3.6.4-jar-with-dependencies.jar and add it to folder libs.

    in build.grade:

    android {
    ...
        configurations {
            all {
                exclude group: 'com.squareup.okhttp3', module: 'okhttp'
            }
        }
    }
    ...
    dependencies {
    ...
     implementation fileTree(include: '*.jar', dir: 'libs')
    ...
    }
    
    0 讨论(0)
  • 2020-12-24 13:58

    Here's a more minimal version of the build.gradle suggested by Sam that works for me:

    apply plugin: 'com.android.application'
    
    android {
    compileSdkVersion 21
    buildToolsVersion "20.0.0"
    
    defaultConfig {
        applicationId "com.example.test"
        minSdkVersion 15
        targetSdkVersion 21
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            runProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
        repositories {
            maven { url 'https://oss.sonatype.org/content/repositories/ksoap2-android-releases' }
        }
    }
    }
    
    dependencies {
        compile fileTree(dir: 'libs', include: ['*.jar'])
        compile 'com.google.code.ksoap2-android:ksoap2-android:3.6.2'
    }
    

    Note that this is the app's build.gradle, I have not made any modifications to the project build.gradle.

    0 讨论(0)
提交回复
热议问题