I have published one library called SmartToolbar to jcenter
successfully.
But I have one problem when I update it to new version and publish it again, it does not show suggestion message to update to new version in gradle
.
Currently, the latest version of this library is 1.0.12
, but as you can see in the screenshot, it doesn't show suggestion message to upgrade to version 1.0.12
as a library above it.
I want to fix it because I want to notify to all developers who are using it to get the latest update from my library.
NOTE: It does not show suggestion that have new version is available but we still get the latest update if we know the latest version. So only me that know about the latest version.n
When I publish new version I have updated the versionName
which I create custom variable as PUBLISH_VERSION
to use with my publish-android-library-plugin as bellow screenshot.
So I want to know more which part that I missed when I publish the new version? or in my publish-android-library-plugin has something not correct? Maybe you need to review this raw code for checking my mistake.
NOTE: This library has synced to maven central
You can specify the Gradle version in either the File > Project Structure > Project menu in Android Studio, or update your Gradle version using the command line. The preferred way is to use the Gradle Wrapper command line tool, which updates the gradlew scripts.
Go to Android Studio -> Preferences -> Plugins (for Mac) and File -> Settings -> Plugins (for windows) and search “Check for Dependency updates plugin”. Install it and restart android studio. You will be able to see Dependencies tab on the right which will show if any dependency has a new update available.
The current Gradle release is version 7.5.1, released on 05 Aug 2022. The distribution zip file comes in two flavors: Binary-only. Complete, with docs and sources.
*UPDATE *
According to our dear friend JBaruch, he said:
The problem is that regardless of which repository your library is resolved from (being it
jcenter()
,mavenCentral()
or any other repository), the check for the latest version is hardcoded to go to Maven Central.
You can read more about his thoughts when answering a similar questions to yours over here: Add Warning "A newer version of ..... is available" for custom library
So, following his suggestion, you can try syncing your library with maven
* PREVIOUS ANSWER: I am leaving this here as I still think it is still important to understand the thinking process behind Android studio's aversion to getting the latest updates *
The version update popup notification is due to a Lint rule in Android Studio, called Newer Library Versions Available
. According to How to check if gradle dependency has new version, the latest few updates to Android studio has modified that lint rule so users will no longer be notified of new non-Google library versions.
JBaruch's answer in How to check what is the latest version of a dependency to use in gradle gives a good reason why Google went with this change:
"Relying on latest version is indeed a dangerous thing to do. Your build can break without you changing anything, just because some library broke backwards compatibility."
Google would prefer developers stick to a particular library version and only update when required. So, checking for updates has become a manual process.
So, how can you proceed from here? If you just want to check that Android Studio is notified of your new library update, you can use Android Studio's proper method of checking for updates. You can look at Adam S's answer (the accepted one) in How to check if gradle dependency has new version for instructions to do the update check.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With