Localbroadcastmanager Not Found In Androidx.appcompat:appcompat:1.1.0 But Available In 1.0.0
Solution 1:
AppCompat 1.0.0 had a transitive dependency on legacy-support-core-utils
(which includes localbroadcastmanager
so as to maintain exact compatibility with the last Support Library 28.0.0 release.
AppCompat 1.1.0 removed that transitive dependency and now only depends on the exact libraries it needs.
Therefore if your application code still needs LocalBroadcastManager
, you need to manually add the dependency on LocalBroadcastManager:
implementation "androidx.localbroadcastmanager:localbroadcastmanager:1.0.0"
Note that as per the LocalBroadcastManager 1.1.0-alpha01 release notes:
androidx.localbroadcastmanager
is being deprecated in version1.1.0-alpha01
.Reason
LocalBroadcastManager
is an application-wide event bus and embraces layer violations in your app; any component may listen to events from any other component.- It inherits unnecessary use-case limitations of system
BroadcastManager
; developers have to useIntent
even though objects live in only one process and never leave it. For this same reason, it doesn’t follow feature-wiseBroadcastManager
.These add up to a confusing developer experience.
Replacement
You can replace usage of
LocalBroadcastManager
with other implementations of the observable pattern. Depending on your use case, suitable options may beLiveData
or reactive streams.
Post a Comment for "Localbroadcastmanager Not Found In Androidx.appcompat:appcompat:1.1.0 But Available In 1.0.0"