Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the correct Way to integrate KSOAP library in Android Studio?

I am trying something like this,

In Gradle,

Inside Build Types,

    repositories {
        maven { url 'http://ksoap2-android.googleco/svde.cmomn/2-repo'
  }

and in dependencies . . .

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

Error: Failed to resolve dependencies

like image 856
Naman Vaishnav Avatar asked Aug 15 '16 14:08

Naman Vaishnav


3 Answers

Solution: inside build.gradle of a module (not project) write:

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

and inside Dependencies

implementation 'com.google.code.ksoap2-android:ksoap2-android:3.6.2'
like image 185
Naman Vaishnav Avatar answered Nov 20 '22 16:11

Naman Vaishnav


in Android Studio, you have two build.gradle File:

My first file (Project):

buildscript {
    repositories {
        jcenter()
        google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.2'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

and my Second File (Module):

apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion '27.0.3'
    defaultConfig {
        applicationId "com.asemansystem.com.caferc"
        minSdkVersion 15
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

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

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:25.3.1'
    compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha7'
    compile 'com.android.support:design:25.3.1'
    compile 'com.android.support:support-v4:25.3.1'
    compile 'com.google.code.ksoap2-android:ksoap2-android:3.6.2'
    testCompile 'junit:junit:4.12'
}
like image 40
Elyas Nategh Avatar answered Nov 20 '22 17:11

Elyas Nategh


Goto to this link and download the jar file. Then add the downloaded jar file to your libs folder inside your app folder(Your Project->app->libs). Then right click on the ksoap jar file and select "Add as Library".

Done.

EDIT : UPDATED THE LINK

like image 35
Akhil Soman Avatar answered Nov 20 '22 17:11

Akhil Soman