今天需要在Android的项目里调用WebService,需要用到第三方jar包ksoap2-android 在app/build.gradle文件里添加 dependencies

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:26+'
    compile 'com.google.code.ksoap2-android:ksoap2-android:3.6.2'
}

点击Sync,发现gradle无法找到该package,于是查询得知需要我告诉gradle下载地址,即添加repositories至app/build.gradle

buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
        repositories {
            maven { url 'https://oss.sonatype.org/content/repositories/ksoap2-android-releases' }
        }
    }