Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon

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

Save for later
  • 2 min read
  • 09 Aug 2018

article-image

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.
  • Unlock access to the largest independent learning library in Tech for FREE!
    Get unlimited access to 7500+ expert-authored eBooks and video courses covering every tech area you can think of.
    Renews at €18.99/month. Cancel anytime
  • 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.

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