简体   繁体   English

在我向jcenter发布新版本后,我的Android库不建议在gradle中升级新版本

[英]My Android library not suggest to upgrade new version in gradle after I published new version to jcenter

图片

I have published one library called SmartToolbar to jcenter successfully. 我发表一个库调用SmartToolbarjcenter成功。
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 . 但是当我将其更新为新版本并再次发布时,我遇到了一个问题,它没有显示建议消息以更新到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. 目前,该库的最新版本是1.0.12 ,但正如您在屏幕截图中看到的,它没有显示建议消息升级到版本1.0.12作为它上面的库。

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. 当我发布新版本时,我已经更新了我创建自定义变量的versionName作为PUBLISH_VERSION以与我的publish-android-library-plugin一起使用 ,如下图所示。

图像2

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? 或者在我的publish-android-library-plugin中有不正确的东西? Maybe you need to review this raw code for checking my mistake. 也许您需要查看此原始代码以检查我的错误。

NOTE: This library has synced to maven central 注意:此库已同步到maven central

*UPDATE * *更新*

According to our dear friend JBaruch, he said: 据我们亲爱的朋友JBaruch说,他说:

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 . 问题在于,无论您的库是从哪个存储库中解析出来的(如jcenter()mavenCentral()或任何其他存储库),对最新版本的检查都是硬编码的,以便转到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 因此,根据他的建议,您可以尝试使用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 * *以前的答案:我要离开这里了,因为我仍然认为理解Android工作室厌恶获取最新更新背后的思维过程仍然很重要*

The version update popup notification is due to a Lint rule in Android Studio, called Newer Library Versions Available . 版本更新弹出通知是由Android Studio中的Lint规则引起的,称为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. 根据如何检查gradle依赖项是否具有新版本 ,Android Studio的最新几项更新已修改该lint规则,因此将不再向用户通知新的非Google库版本。

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: JBaruch的答案如何检查在gradle中使用的最新版本的依赖项是 Google为什么要采用这种变化的一个很好的理由:

"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. 如果您只是想检查Android Studio是否有新的库更新通知,您可以使用Android Studio检查更新的正确方法。 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. 您可以查看Adam S的答案(已接受的答案) 如何检查gradle依赖项是否有新版本以进行更新检查。

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

相关问题 新版本的库未与jcenter同步 - New version of library is not synchronized with jcenter 从服务器下载Android应用程序后不会升级为新版本 - Android app does not upgrade for a new version after download it from the server Android:应用程序升级而不是新版本 - Android: application upgrade rather than new version 升级到新版本时清除android缓存 - Clear android cache during the upgrade to new version Gradle新版本和Build版本 - Gradle new version and Build version Android为build.gradle制作新版本 - android make new version for build.gradle Android升级旧版本。 新版本在清单中具有新的权限,但是当我升级时,该应用程序崩溃并显示我需要该权限 - Android upgrading older version. New version has a new permission in manifest, but when I upgrade, the app crashes and it says I need that permission 在Bintray上发布的Android库,但在jcenter上不可用 - Android library published on bintray but is not available at jcenter 为什么在安装新版本的Android Studio后我的Genymotion模拟器丢失了? 怎么解决呢? - Why my Genymotion emulator lost after I install new version of Android studio? How to solve it? 如何在不覆盖以前版本的情况下将新版本的android游戏安装到android设备? - how do i install a new version of my android game to my android device without overwriting the previous version?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM