-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Androidx migration #627
Androidx migration #627
Conversation
Updated Android SDK and build tools.
This would be great, as I am trying to remove the jetifier in my project. |
@mdzyuba What is the benefit of this change? Can EventBus still be used with older environments or is an upgrade to AndroidX forced, which I found unacceptable. |
The main benefit of this upgrade is to make EventBus compatible with projects that are using current Android libraries (AndroidX). This change does not restrict EventBus for older environments. Currently EventBus depends on Android Support Libraries v.4.1.1.4 released in 2015. Google has deprecated Support Libraries and released an open source alternative - AndroidX in 2018. In order to keep the applications up to date with latest Android APIs, Android developers have to upgrade their projects to AndroidX. The process of migration to AndroidX is described here: https://developer.android.com/jetpack/androidx/migrate. Mixing Support Libraries and AndroidX libraries in any level of the dependency graph is problematic and not always possible. The Android Support Libraries classes had been moved to new Java packages under androidx.*. The new Android gradle plugin provides a Jetifier tool that migrates classes in Support Libraries v.28 to AndroidX v1.0 at the build time. However, is does not work well for older Android Support libraries, which is the case with EventBus. Here is the current code: https://github.com/greenrobot/EventBus/blob/master/EventBus/build.gradle#L27 Here is the Maven repository with details on the library release date: If we want EventBus to be useful for the current Android development, we have to update its dependencies and migrate the code to AndroidX. This is the main goal of this pull request. |
Any update on that? Next to incremental build, dropping android support libs is the most important change to keep the library from dying. |
Associated issue: #552 |
@mdzyuba "Mixing Support Libraries and AndroidX libraries in any level of the dependency graph is problematic and not always possible." what do you mean by that? can you give us some examples? since 2018 until now I have been using EventBus with Jetifier extensively, got absolutely no problems. |
Yes, Jetifier works and can be used. However, there are a few reasons not to do that. Here are some. Generally, mixing two versions of the same library used by different dependencies in the same apk leads to build time issues and requires extra work on resolving conflicts in dependencies. Mixing different versions of the same android support libraries is not safe. It can lead to crashes. Please see https://stackoverflow.com/questions/42374151/all-com-android-support-libraries-must-use-the-exact-same-version-specification and https://stackoverflow.com/questions/53938393/android-studio-library-error-mixing-versions-can-lead-to-runtime-crashes-and-a for more details. Even if mixing libs does not lead to crashes, it leads to duplication of code. Removing the duplication in builds takes extra work. Jetifier was designed as a temporary solution to help with transitioning from android support libs to androidX. There is no reason to keep using it if the project can move to AndroidX. |
it is a pity not to migrate to AndroidX |
@ooyellow58 See #552 (comment) A preview release with Android X support is now available. |
Hello,
I would like to contribute an AndroidX upgrade as well as the project upgrade to the Android library (aar).
Thank you,
Mykola