Changelog History
Page 1
-
v2.30.1 Changes
November 24, 2020π Bug fixes
- π Sets the default value for
experimentalDaggerErrorMessages
back todisabled
since it breaks hyperlinks in AndroidStudio (6a8bbbf) . Note that this reverses the change to the default value made in the release 2.30. - π Fixes #2190: Dagger was unnecessarily inspecting all fields of a class and attempting to find their Kotlin metadata, which sometimes led to crashing the processor. Now, Dagger inspects the Kotlin metadata lazily, and only on the fields that require it. (a885c85)
- π Sets the default value for
-
v2.30 Changes
November 20, 2020Whatβs new
Hilt
π Hilt has deprecated
ApplicationComponent
(6313cbd), and it will soon be removed in a future release. UseSingletonComponent
instead.π Hilt now supports
@BindValue val
fields in Kotlin without the use of@JvmField
(802882d). For example:// Before@BindValue @JvmField val bindStr = "STRING\_BINDING"// Now@BindValue val bindStr = "STRING\_BINDING"
Dagger
π Dagger now uses the βexperimentalDaggerErrorMessagesβ by default (See #1769 for more information). The old error message format can still be used by setting
-Adagger.experimentalDaggerErrorMessages=disabled
as a javacopt.π Bug Fixes
- π [Dagger]: Fixes a Dagger compiler crash that occurred when an @Inject was placed in a Kotlin object class. (0816c43)
- β‘οΈ [Hilt]: Fixes #2156: Update Dagger's androidx dependencies to the latest stable versions. (deff5e5)
- π [Hilt]: Fixes suppress deprecation warning in Hilt generated Fragment class. (0a463eb)
- π [Hilt]: Removes Hilt's dependency on jsr250 for
@Generated
. (8dca74b)
Note: Hilt previously depended on jsr250 for the@Generated
annotation, but this behavior has now been changed to match Dagger (see #95). Now, Hilt only adds the@Generated
annotation only if theGenerated
class is present in the classpath. Thus, since weβve now removed the jsr250 dependency from Hilt, the generated code will no longer contain the@Generated
annotation by default.
-
v2.29.1 Changes
September 10, 2020Whatβs New
Hilt
π Hilt has two new artifacts
hilt-core
andhilt-compiler
that allow Hilt to be used with pure Java/Kotlin libraries within an AndroidApplication (see issue #1908 for the full motivation/discussion).The
hilt-core
artifact contains the core (non-Android) Hilt APIs. Note that this artifact is only meant to be used by pure Java/Kotlin libraries within an Android application. Hilt does not currently support non-Android applications or non-Android tests.The
hilt-compiler
artifact is just a rename ofhilt-android-compiler
. The motivation here is to have a single compiler artifact that works with both Android and non-Android libraries. Thehilt-android-compiler
artifact will be deprecated in a future release, so please migrate tohilt-compiler
.The example below shows which artifacts to use in an Android vs pure Java/Kotlin library.
// Android library depsdependencies { implementation "com.google.dagger:hilt-android:2.29-alpha" androidTestImplementation "com.google.dagger:hilt-android-testing:2.29-alpha" annotationProcessor "com.google.dagger:hilt-compiler:2.29-alpha" // or kapt}// Pure Java/Kotlin library depsdependencies { implementation "com.google.dagger:hilt-core:2.29-alpha" annotationProcessor "com.google.dagger:hilt-compiler:2.29-alpha" // or kapt}
Dagger:
π A new Dagger compiler option was added to allow disabling transitive validation of component dependency,
dagger.validateTransitiveComponentDependencies
,. The default value for the flag is enabled (same as before). To disable it, add the following to your compiler options:-Adagger.validateTransitiveComponentDependencies=DISABLED
. For a full motivation/discussion, see issue #970.π A new Dagger compiler option was added to fix an issue with map binding contributions that depend on subcomponent bindings,
dagger.strictMultibindingValidation
. The default value for the flag is disabled (same as before). However, we will be enabling this flag in a future release. To check if your application will be affected, you can enable the flag by adding the following to your compiler options:-Adagger.strictMultibindingValidation=ENABLED
. See #2085 for details.Potential breaking changes
- π Fix an issue where in some cases missing bindings may have been missed during validation. This issue also affects the binding graph that SPI plugins receive so this fix may cause changes where a previously incorrect binding graph was being supplied. (08193ad)
π Bug Fixes
- π Fix #1955, #2065: Hilt would incorrectly try to transform native methods on classes annotated with
@AndroidEntryPoint
. (2099bad, 2099bad) - π Fix #1918: Support
BroadcastReceiver
with@AndroidEntryPoint
transform. (ede018b) - π Fix #1997: Allow Hilt modules to have constructors with params as long as a no-arg constructor exists. (07a7fa9)
- π Fix #2042: Fix bug in
OriginatingElementProcessor
and ban@AndroidEntryPoint
classes with type parameters. (bee2e9a) - π Fix #970: Add
-Adagger.validateTransitiveComponentDependencies
compiler option to prevent validating transitive component dependencies. (6deafc7) - β Add
-Adagger.strictMultibindingValidation
compiler option to fix map binding contributions that depend on subcomponent bindings. (fb47e11) - π Fix issue with
@Binds
when the impl extends a generated type. (71509b8) - β Add support for receiving a callback for when the activity retained component will no longer be used and destroyed. (6300d02, 218df98)
- Throw when a race is detected adding a OnClearedListener. (7cf8b11)
- β¬οΈ Reduce constant pool usage by renaming private methods (4a31157)
-
v2.29 Changes
September 10, 2020 -
v2.28.3 Changes
July 17, 2020 -
v2.28.2 Changes
July 15, 2020Whatβs new
Hilt
π The Hilt class
dagger.hilt.android.components.ApplicationComponent
is being renamed todagger.hilt.components.SingletonComponent
. This release adds the newSingletonComponent
class in preparation for this change without removing the existingApplicationComponent
. This rename is part of a plan to address #1908 to allow usage of Hilt in non-Android Gradle modules when installing into theSingletonComponent
. Current users can begin switching to the newSingletonComponent
name as of this release. A future release will removeApplicationComponent
.π Bug fixes
Hilt
- π Fix #1980: Added missing FIELD target to @ActivityContext qualifier. (29e080f)
- π Fix #1909: Update Dagger's JavaPoet dependency to 1.13.0 containing fixes for Dagger & Hilt related to generating code with overriding methods without annotations. (c5de4ab)
- π Fix #1955: Fixes issue with bytecode transformation in Gradle plugin to allow @AndroidEntryPoint annotations to be used with abstract classes containing abstract methods. (884fee5)
- π Fix #1947: Fixes issue with Hilt base classes that extend other Hilt base classes. (61c5c43)
- π Fix #1917: Fixes Hilt example app for Gradle users on mac. (5b3a966)
-
v2.28.1
June 18, 2020 -
v2.28
May 26, 2020 -
v2.27 Changes
March 13, 2020What's New
- Fix #955: No longer generate MembersInjectors for types without local injection sites. (20f6442)
- Fix #1414: Allow multiple scoped component dependencies (113c498) π 3. Fix #1734: Add support constructor with content layout id for AndroidX (22b2726) π 4. 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.
-
v2.26 Changes
January 30, 2020What's new
π 1. 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)
π 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 toComponent#modules
(orSubcomponent#modules
) list. Instead, only the outer class should be added to the module list.// Only add this class to the Component#modules list.@Moduleabstract 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