简体   繁体   English

如何在 android studio 中获取最新版本的库?

[英]How to get latest version of library in android studio?

I want to use a library from GitHub but I'm able to get it's latest version.我想使用来自 GitHub 的库,但我能够获得它的最新版本。

Library:图书馆:

implementation 'com.github.mukeshsolanki:android-otpview-pinview:<latest-version>'

Github repo: https://github.com/mukeshsolanki/android-otpview-pinview Github 回购: https://github.com/mukeshsolanki/android-otpview-pinview

I have searched everywhere but I don't know what to write at place of <latest-version>我到处搜索,但我不知道在<latest-version>的地方写什么

If you want to get the latest version of the library module all the time when you are building your project, you might consider doing as follows.如果您想在构建项目时始终获取最新版本的库模块,您可以考虑执行以下操作。

implementation "com.github.mukeshsolanki:android-otpview-pinview:+"

Putting a + instead of the exact version name will get the latest version available from your remote or local maven repo.使用+而不是确切的版本名称将从远程或本地 maven 存储库中获得最新版本。 Don't forget to put the double quotes (ie " ) instead of those single quotes as well.不要忘记加上双引号(即" )而不是那些单引号。

Also, you might consider having the following configuration in your android section of the build.gradle file.此外,您可能会考虑在build.gradle文件的android部分中具有以下配置。

configurations.all {
    // Check for updates every build
    resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
}

Please note that having a + for the versions might lead to getting unwanted bugs or version updates that you might not want.请注意,为版本加上+可能会导致出现您可能不想要的不需要的错误或版本更新。 Hence, using a specific version as 2.1.0 as mentioned in the comment is a safer choice.因此,使用评论中提到的特定版本作为2.1.0是更安全的选择。

A way to get the last version is to check the releases on GitHub.获得最新版本的一种方法是检查 GitHub 上的版本。

Open the link you wrote then click on "Tags" above the library directories on the left of "Go to file" & "Code" buttons.打开您编写的链接,然后单击“转到文件”和“代码”按钮左侧的库目录上方的“标签”。 Here you can find all the tags the developer used on the branch, now click on the "Releases" button and here you should be able to get the last version of the library (:在这里您可以找到开发人员在分支上使用的所有标签,现在单击“发布”按钮,在这里您应该能够获得该库的最新版本(:

For the library you wrote the last version should be "2.1.2".对于您编写的库,最后一个版本应该是“2.1.2”。

Here: Releases of the library you wrote此处: 您编写的库的版本

Firstly:- You can do something like this and the android studio will suggest to you what is the latest lib version is available as follows:-首先:-你可以这样做,android 工作室会向你建议最新的 lib 版本如下:-

implementation 'com.github.mukeshsolanki:android-otpview-pinview:0.0.1'

在此处输入图像描述

Secondly:- Adding '+' for the library NOT considered be a good practice.其次:-为库添加“+”不被认为是一个好习惯。

在此处输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在最新版本的Android Studio中导入Actionbar Sherlock库 - How to import Actionbar Sherlock library in new latest version of Android Studio 如何让 Sceneform 1.16.0 与 Android Studio 最新版本一起使用 - How to get Sceneform 1.16.0 working with Android Studio latest version 如何在 Android Studio 中使用最新的 gradle 版本 - How to use the latest gradle version in Android Studio 如何获取最新安装的android版本的日期? - How to get the date of latest installed android version? Android:如何在android studio中配置FFMPEG最新版本? - Android: How to configure FFMPEG latest version in android studio? 如何在android studio中选择特定版本的库 - how to choose a specific version of library in android studio Android Studio:如何找到谷歌特定库的最新版本号? - Android Studio : How to find latest version number of google specific libraries? 如何在 Android Studio 中查找最新版本的 Kotlin - How to find out the latest version of Kotlin in Android Studio 如何下载最新版 Android SDK for Visual Studio .NET 2017 - How to download the latest version of Android SDK for Visual Studio .NET 2017 如何在最新版本的Android Studio上创建签名APK - How to create a Signed APK on the latest version of Android Studio
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM