File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -65,7 +65,7 @@ broken by this change it can usually be fixed by just moving the module to the
6565correct component. For example, we can fix the case above by installing the
6666module into the ` ActivityComponent ` instead of the ` SingletonComponent ` :
6767
68- ## fastInit mode
68+ ## fastInit mode {#fast-init}
6969
7070You can choose to generate your Dagger [ ` @Component ` ] s in a mode that
7171prioritizes fast initialization. Normally, the number of classes loaded when
@@ -95,9 +95,11 @@ leaks would always have the potential to have grow dependencies on the activity
9595as the codebase changes (thereby leaking it in the default mode as well).
9696
9797To enable fastInit mode, pass the following option to javac when building your
98- Dagger [ ` @Component ` ] : ` -Adagger.fastInit=enabled ` . Note that if you are using
99- the Hilt Gradle Plugin in your project, fastInit mode will already be enabled by
100- default.
98+ Dagger [ ` @Component ` ] : ` -Adagger.fastInit=enabled ` .
99+
100+ ** Note:** If you are using Hilt, fastInit mode is enabled by default but can be
101+ configured differently. See
102+ [ Hilt Fast Init] ( https://dagger.dev/hilt/flags#fast-init ) for more details.
101103
102104## Turning on code formatting
103105
Original file line number Diff line number Diff line change @@ -78,6 +78,23 @@ a migration. To turn off this check, this flag can be used:
7878
7979` -Adagger.hilt.disableCrossCompilationRootValidation=true ` .
8080
81+ ## Fast Init {#fast-init}
82+
83+ Hilt [ "Fast Init"] [ fast-init-link ] is an optimization that improves
84+ startup performance by avoiding class loading during Hilt initialization. It is
85+ the recommended mode for android applications.
86+
87+ If you are not using the Hilt Gradle plugin, see Dagger's
88+ [ compiler options] [ compiler-options-link ] for instructions on how
89+ to enable Fast Init.
90+
91+ If you are using the Hilt Gradle plugin:
92+
93+ * FastInit is enabled by default.
94+ * FastInit can only be disabling via the ` dagger.hilt.fastInit ` Gradle
95+ property, e.g. via command line: ` -Pdagger.hilt.fastInit=false ` .
96+ * Hilt will fail if you try to set the flag via Annotation Processing options.
97+
8198## Runtime flags
8299
83100Runtime flags to control Hilt behavior for rollout of changes. These flags are
@@ -123,3 +140,6 @@ This flag used to be paired with a compiler option flag
123140` dagger.hilt.android.useFragmentGetContextFix ` , however, as of Dagger 2.40 this
124141compiler option has now been removed and this behavior is only controlled via
125142the runtime flag.
143+
144+ [ fast-init-link ] : https://dagger.dev/compiler-options.html#fastinit-mode
145+ [ compiler-options-link ] : https://dagger.dev/compiler-options.html#fastinit-mode
You can’t perform that action at this time.
0 commit comments