Skip to content

Dagger 2.26

Compare
Choose a tag to compare
@bcorso bcorso released this 30 Jan 00:35
· 1513 commits to master since this release

What's new

  1. Fix #1700: Remove usages of non-Android Guava APIs. (0925e8f)
  2. Fix #1720: Fix incremental dagger-android-processor in kapt when using dagger.android.experimentalUseStringKeys. (6a0ce58)
  3. Fix #1721: Migrate dagger-android to AndroidX. (f45213e)
  4. 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