15

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

Naman Vaishnav
  • 1,069
  • 1
  • 13
  • 24

5 Answers5

37

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'
CoolMind
  • 26,736
  • 15
  • 188
  • 224
Naman Vaishnav
  • 1,069
  • 1
  • 13
  • 24
3

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'
}
Elyas Nategh
  • 540
  • 6
  • 5
  • 1
    Thanks. `repositories { }` branch in module's `build.gradle` helped. But in an accepted answer `mavenCentral()` is unneeded, so you can also remove it. – CoolMind Oct 01 '18 at 08:02
1

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

Akhil Soman
  • 2,077
  • 2
  • 17
  • 30
0

this is mine in new versions of Android Studio:

in build.gradle (module):

dependencies {
    ...
    implementation 'com.google.code.ksoap2-android:ksoap2-android:3.6.4'
}

in settings.gradle:

pluginManagement {
    repositories {
        gradlePluginPortal()
        google()
        mavenCentral()
    }
}
dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        google()
        mavenCentral()
        maven { url 'https://oss.sonatype.org/content/repositories/ksoap2-android-releases/' }
    }
}
rootProject.name = "idt.pda"
include ':app'
-1

Another way is:

1: Download the ksoap2-versionX.jar file from here.

2: Copy ksoap2-versionX.jar file to libs folder in your project.

3: Right click in the copied file in your project and select Add as library.

See: http://ask.android-studio.org/?/question/188

CGR
  • 370
  • 1
  • 4
  • 18