My Android library not suggest to upgrade new version in gradle after I published new version to jcenter
Asked Answered
C

1

7

image

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.

image2

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

Casavant answered 10/9, 2018 at 4:50 Comment(0)
Q
9

*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.

Quassia answered 13/9, 2018 at 2:47 Comment(5)
I think your answer is acceptable after I tested with other libraries which is not the most popular one, but I wonder why library like onesignal, retrofit, okhttp, and other popular one which is not the Google library version can alert this message when newer version is available?Casavant
I have updated my answer for explanation of your particular case. I thought you wanted users to always have the latest version of your libraryQuassia
Of course, I always sync my library to maven too after i publish successfully to jcenter. That's why I try to get solution here bro.Casavant
You can check here to see my library on maven central bro.Casavant
Unfortunately, this didn't work out. Probably the Maven url has changed(( Still looking for a solution...Saddler

© 2022 - 2024 — McMap. All rights reserved.