Dagger 2.26
What's new
- Fix #1700: Remove usages of non-Android Guava APIs. (0925e8f)
- Fix #1720: Fix incremental dagger-android-processor in kapt when using dagger.android.experimentalUseStringKeys. (6a0ce58)
- Fix #1721: Migrate dagger-android to AndroidX. (f45213e)
- Better support for binding declarations within Kotlin companion objects of
@Module
annotated classes. (8190c7c)
Known breaking changes
Companion object modules are no longer allowed on Component#modules
list (8190c7c)
It is now an error to add an @Module
annotated companion object class to Component#modules
(or Subcomponent#modules
) list. Instead, only the outer class should be added to the module list.
// Only add this class to the Component#modules list.
@Module
abstract class FooModule {
@Binds abstract fun bindFoo(impl: FooImpl): Foo
// @Module is no longer needed here!
companion object {
// @JvmStatic is no longer needed here!
@Provides fun provideBar(): Bar = Bar()
}
}
Note: For backwards compatibility, we still allow @Module
on the companion object and @JvmStatic
on the provides methods. However, @Module
on the companion object is now a no-op and all of its attributes (e.g. "includes") will be ignored. In future releases, we will make it an error to use @Module
on a companion object.
Dagger Android artifacts now use Androidx (f45213e)
The following artifacts have been migrated from the support library to AndroidX:
com.google.dagger:dagger-android:2.26
com.google.dagger:dagger-android-support:2.26
This change may break users who have not already migrated to AndroidX. The fix is to either migrate your app to AndroidX, or switch back to the support library artifacts which are now available at:
com.google.dagger:dagger-android-legacy:2.26
com.google.dagger:dagger-android-support-legacy:2.26