Skip to content

Simplify Startup Initializers #52

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

SimonMarquis
Copy link
Contributor

@SimonMarquis SimonMarquis commented May 31, 2025

Since the project current modularization does not yet allow to split bindings and the rest of the code, moving the Initializers registration to the :app module makes it easier to use.

  • It avoids duplicated registrations (it was both present in :app and :core:network)
  • It avoids removing registrations on other modules that would break during instrumented tests

EnsureInitializerMetadata had to be suppressed because the Lint rule does not actually check where the initializer are registered, and always expects to see it on the same module, which is quite a simplistic assumption. https://googlesamples.github.io/android-custom-lint-rules/checks/EnsureInitializerMetadata.md.html

I also remove the hardcoded androidx.startup string with the proper string reference @string/androidx_startup.

Finally, I removed core/network/src/main/res/xml/startup_initializers.xml which seems unused and is not documented in the official APIs.

Closes #51

Since the project current modularization does not yet allow to split bindings and the rest of the code, moving the `Initializer`s registration to the `:app` module makes it easier to use.

- It avoids duplicated registrations (it was both present in `:app` and `:core:network`)
- It avoids removing registrations on other modules that would break during instrumented tests

`EnsureInitializerMetadata` had to be suppressed because the Lint rule does not actually check where the initializer are registered, and always expects to see it on the same module, which is quite a simplistic assumption.
https://googlesamples.github.io/android-custom-lint-rules/checks/EnsureInitializerMetadata.md.html

I also remove the hardcoded `androidx.startup` string with the proper string reference `@string/androidx_startup`.
@riggaroo riggaroo requested a review from keyboardsurfer June 9, 2025 14:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

What is startup_initializers.xml used for?
2 participants