I\'m trying to make kSOAP working in my Android project with Gradle.
This is my project\'s build.gradle file:
buildscript {
repositories {
These answers are pretty old and none of them worked for me. Here is my solution using Android Studio 3.1.4 and ksoap 3.6.4
android gradle:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.4'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
repositories {
maven { url 'https://oss.sonatype.org/content/repositories/ksoap2-android-releases/' }
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
app gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.myapp.aspservicetest"
minSdkVersion 24
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
repositories {
maven { url 'https://oss.sonatype.org/content/repositories/ksoap2-android-releases' }
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.google.code.ksoap2-android:ksoap2-android:3.6.4'
}
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.