Mobile

Dagger 2.17, a dependency injection framework for Java and Android, is now out!

2 min read

After the consecutive release of Dagger 2.15 and 2.16 in May earlier this year, Dagger 2.17 was released with enhanced performance and bug fixes. This dependency injection framework for Java and Android allows developers to focus on the interesting classes (the classes that actually do stuff!). You just need to declare the dependencies, specify how to satisfy them, and ship your app.

What’s new in Dagger 2.17?

Bug fixes and error improvements:

  • Previously, when a @Binds method in a parent was used only from a child, whose dependency was missing in the parent but present in the child, it used to result in a valid graph. Dagger now reports an error in such cases.
  • An error is reported for binding methods that have more than one scope annotation, instead of throwing an exception.
  • If two entry point methods with different keys are inherited from different supertypes of a component type, Dagger reports an error.
  • Dagger reports an error for scope annotations on @BindsOptionalOf methods. Apply scope to the non-optional binding that satisfies the optional binding, instead of the @BindsOptionalOf method.
  • You should install AndroidInjectionModule or AndroidSupportInjectionModule when using dagger.android, otherwise Dagger 2.17 will throw a missing binding error.
  • Bug fixed to report cycles if some components have no entry points that depend on the cycle.
  • Bug fixed where scope annotations in error messages were missing annotation attributes.

Additions and deprecations:

  • An option is added to use string keys for dagger.android and allow the keys to be obfuscated. You can enable this mode with the -Adagger.android.experimentalUseStringKeys flag.
  • experimentalAndroidMode is renamed to fastInit.
  • dagger.android.DaggerFragment is deprecated, use dagger.android.support.DaggerFragment instead. This is done to match Android Pie’s deprecation of framework fragments.

Checkout Dagger’s Github page for more on the 2.17 release.

Read Next

Introducing Android 9 Pie, filled with machine learning and baked-in UI features

All new Android apps on Google Play must target API Level 26 (Android Oreo) or higher, to publish

Android Studio 3.2 Beta 5 out, with updated Protobuf Gradle plugin

Bhagyashree R

Share
Published by
Bhagyashree R

Recent Posts

Top life hacks for prepping for your IT certification exam

I remember deciding to pursue my first IT certification, the CompTIA A+. I had signed…

3 years ago

Learn Transformers for Natural Language Processing with Denis Rothman

Key takeaways The transformer architecture has proved to be revolutionary in outperforming the classical RNN…

3 years ago

Learning Essential Linux Commands for Navigating the Shell Effectively

Once we learn how to deploy an Ubuntu server, how to manage users, and how…

3 years ago

Clean Coding in Python with Mariano Anaya

Key-takeaways:   Clean code isn’t just a nice thing to have or a luxury in software projects; it's a necessity. If we…

3 years ago

Exploring Forms in Angular – types, benefits and differences   

While developing a web application, or setting dynamic pages and meta tags we need to deal with…

3 years ago

Gain Practical Expertise with the Latest Edition of Software Architecture with C# 9 and .NET 5

Software architecture is one of the most discussed topics in the software industry today, and…

3 years ago