Releases: google/dagger
Dagger 2.28.1
What's New
New Bazel helper macros for using Dagger. See the updated README for instructions. There are also examples using these macros for Dagger and Hilt (9494f40).
Bug fixes
Hilt
- Throws an error when @androidentrypoint base classes use default params in Kotlin. This is a temporary stopgap while support is investigated (2d43349).
- Fixes #1910: Allow usage of an @androidentrypoint class having an @androidentrypoint base class when using the gradle plugin (3a31bf6).
- Fixes #1864: Add minSdkVersion to Lint AndroidManifest.xml. This fixes problems of incorrect added permissions to the manifest (85f285c).
Dagger 2.28
What's New
Hilt Alpha Release
Hilt is a new library that layers on top of Dagger and provides a standard way to incorporate Dagger into an Android application. For more information, see https://dagger.dev/hilt.
Lint checks in Dagger for Kotlin (2597f5a)
Dagger now includes Lint checks for Kotlin users. The checks cover the following cases:
- Using a redundant
field:
site target in injected properties - Using a redundant
@JvmStatic
in object modules. - Annotating companion objects with
@Module
(@Module
should just be on the enclosing class)
These checks are included by default for users of dagger-android
and hilt-android
. For Kotlin only projects the checks are available in a new artifact, com.google.dagger:dagger-lint:<version>
and can be applied via the lintChecks
configuration in Gradle:
apply plugin: "com.android.lint"
dependencies {
lintChecks "com.google.dagger:dagger-lint:<version>"
}
Bug Fixes
- Fixes #1812: Fix deploy script for Mac by updating bazel-common containing a fix in the jarjar macro. (11c86ec)
- Fixes #1693: Gracefully handle
@kotlin.Metadata
produced by Kotlin compiler versions earlier than 1.3. (477d052) - Fixes #1805: Add custom lint checks to Dagger (2597f5a)
- Fixes #1769: Minor fixes to error messages (8e29da2)
Dagger 2.27
What's New
- Fix #955: No longer generate MembersInjectors for types without local injection sites. (20f6442)
- Fix #1414: Allow multiple scoped component dependencies (113c498)
- Fix #1734: Add support constructor with content layout id for AndroidX (22b2726)
- Fix #1740: Remove a usage of Guava API not available in the '-android' variant in case of processor classpath conflicts. (bfb87d5)
- Fix #1665: Add an explicit check for member injection of Kotlin object classes rather than crashing. (550d696)
- Fix: #1612: Fix duplicate binding errors when a component dependency has the same method defined multiple times via multiple interfaces (0bb69e9)
Experimental Error Message Format
This release includes a flag for using the new experimental error message format. The format and some content of error messages will be changed with this flag in order to improve readability. Please leave feedback on issue #1769. Pending feedback, this format will eventually become the default and replace current error messages.
To opt-in to the new format use -Adagger.experimentalDaggerErrorMessages=enabled
.
Currently, this flag:
- Shortens all class names to the simple class name. A legend is output at the bottom of the errors to map short names to fully qualified names.
- Reports errors as a single error for each root component.
- Adds color to error tags to visibly separate individual errors
- Reduces some extraneous information from some messages.
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
Dagger 2.25.4
Dagger 2.25.3
What's new
-
Bug fixes
-
Maintenance
Dagger 2.25.2
Known breaking changes
- The Kotlin change in
2.ii
(below) will break users who were passing in object module
instances into a Component builder method rather than using@JvmStatic
.
To fix this issue, remove the call to the builder method -- the module instance is
no longer needed and the Component builder method will no longer be generated.
What's new
-
Bug fixes
- Fix duplicate missing binding error messages. (2411074)
- Fix dagger-spi pom file from dependency cycle. (3699697)
- Fix issue with missing shaded deps from release 2.25 (efe1b00)
-
Kotlin support
-
Performance Improvements
Dagger 2.25
Do not depend on this release.
Depend on release 2.25.2 instead, which fixes issue #1639.
Dagger 2.24
- Deprecations/removals
dagger.android
'sHas{Activity,Fragment,Service,ContentProvider,BroadcastReceiver}
interfaces are now removed in favor ofHasAndroidInjector
(which can handle any type).HasAndroidInjector
was added in 2.23, and is supported together with the old types in that version. (3bd8f70)
- Bug fixes
- Duplicate keys were erroneously not detected when MapKey.unwrapValue=false which may have resulted in a runtime error (depending on whether fastInit mode was used). This is now detected and failed at compile time. (8b5dbea)
- Build performance
- Gradle's incremental annotation processing is now enabled for all builds (50bc180)
Dagger 2.23.2
In addition to the 2.23.1 release notes, this release: