在日常開發(fā)過程中蹄梢,我們通過會依賴很多的第三方庫項目晌砾。類似這樣:
dependencies {
compile 'com.android.support:support-v4:24.2.1'
compile 'com.google.code.gson:gson:2.4'
compile 'com.lzy.net:okhttputils:1.7.0'
compile 'com.github.ybq:Android-SpinKit:1.1.0'
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.3'
compile 'me.grantland:autofittextview:0.2.1'
compile 'de.hdodenhof:circleimageview:2.1.0'
}
我時常有個疑惑区匣,我依賴的這些第三方庫項目,都發(fā)布哪些版本廓块,最新版本是什么呢? 經(jīng)過一番google后契沫,我找到了查看這些版本的方式带猴! 很簡單!
第一步:進入studio的setting>plugins 然后 安裝Depencencies Version Checker這個插件懈万。
521747a8-abe7-411d-982b-6a4f0527e0d0.png
第二步:重啟studio后拴清,就可以看到VersionChecker這個tab
微信截圖_20170712110714.png
第三步:輸入你的build.gradle腳本到VersionChecker窗口左側輸入欄中。
輸入的腳本為:根build.gradle腳本的下面這個部分:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
然后加上会通,你想檢查的module的全部build.gradle的內(nèi)容口予。 然后點擊VersionCheck按鈕。就可以在右側看到依賴庫的發(fā)版的版本和最新版本了涕侈。
微信截圖_20170712111203.png
以com.google.code.gson:gson第三方庫為例:我們可以看到使用版本為2.4沪停, 最新版本為2.8.1。 點擊右側的藍色庫的鏈接裳涛,就可以看到該庫發(fā)布的歷史版本了木张。
例:
微信截圖_20170712111512.png
最后付上完整的VersionChecker的輸入腳本,以便大家對照端三!
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion '25.0.0'
defaultConfig {
applicationId "com.zhy.sample_okhttp"
minSdkVersion 10
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
lintOptions{
abortOnError false
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.2.1'
compile project(':okhttputils')
// compile 'com.zhy:okhttputils:2.6.1'
compile 'com.google.code.gson:gson:2.3.1'
compile 'com.squareup.okhttp3:okhttp-urlconnection:3.2.0'
compile 'com.github.franmontiel:PersistentCookieJar:v0.9.3'
}
最后有一個疑問VersionChecker這個插件可以看到一些第三方的庫的歷史版本和最新版本舷礼。但是看不到android support libiary的歷史版本和最新版本。 有人知道查看android support libiary的方式的話技肩,請指點一下我且轨。 感謝!虚婿!