gradle 引入三方 lib

2018-03-09  本文已影响0人  钢铁小肥侠

ksoap2-android 为例

获取 url group version

<url>https://oss.sonatype.org/content/repositories/ksoap2-android-releases/</url>
<groupId>com.google.code.ksoap2-android</groupId>
<version>3.6.2</version>

设置 project gradle:

buildscript {
    ...
    //1 设置版本号
    ext.ksoap_version = '3.6.2'
    repositories {
        ...
        //2 引入仓库
        maven { url 'https://oss.sonatype.org/content/repositories/ksoap2-android-releases/' }
    }
    dependencies {
        ...
        //3 引入 lib
        classpath "com.google.code.ksoap2-android:ksoap2-android:$ksoap_version"
    }
}

allprojects {
    repositories {
        ...
        //4 引入仓库
        maven { url 'https://oss.sonatype.org/content/repositories/ksoap2-android-releases/' }
    }
}

设置 app gradle

dependencies {
    ...
    // 引入 lib
    compile "com.google.code.ksoap2-android:ksoap2-android:$ksoap_version"
}
上一篇下一篇

猜你喜欢

热点阅读