简体   繁体   中英

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.

Library:

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

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

I have searched everywhere but I don't know what to write at place of <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. 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.

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.

A way to get the last version is to check the releases on 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".

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:-

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

在此处输入图像描述

Secondly:- Adding '+' for the library NOT considered be a good practice.

在此处输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM