【发布时间】:2015-07-18 18:08:26
【问题描述】:
我是 Android 开发的新手。所以外部库(又名依赖项)是在build.gradle 中定义的
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:support-v13:21.0.0'
compile 'com.squareup.dagger:dagger:1.2.1'
compile 'com.google.code.gson:gson:2.1'
compile 'de.greenrobot:eventbus:2.4.0'
}
有没有一种简单的方法可以找出这些库中是否有更新的版本?我注意到 Android Studio 提示新版本可用于 gson,但不适用于其他库。
我是iOS背景的,CocoaPods是我们用来管理外部库的工具。使用pod outdated 命令,很容易找出哪些库有新版本进行升级。
【问题讨论】:
-
如果您想使用最新版本,您可以像这样添加“+”号:
compile 'com.squareup.dagger:dagger:1.+',您将获得最高 1.9.9 版本的更新。是您要问的,您只是想了解有关更新吗? -
除了上面@Android777 所说的之外,Gradle 会自动检查新版本并在构建或编辑 build.gradle 时显示警告(如果不使用最新版本)。
-
@Android777 谢谢,但使用 + 会导致 Android Studio 抱怨“避免在版本号中使用 +:...”。我只想知道更新
-
@ozbek 谢谢,但就像我说的,Android Studio 只会警告我 Google 的库没有使用最新版本,比如 gson。您的 Android Studio 是否会通知您所有依赖项的可用更新?
标签: android maven android-studio android-gradle-plugin jcenter