AndroidX Support Library classes cause binding failure
See original GitHub issueVersions:
Dagger 2.16
Android Studio 3.2 Beta 1
Support Library: androidx.appcompat:appcompat:1.0.0-alpha3
When I use dagger.android.support.DaggerApplication
as the base class for my Application, I receive this error upon compilation.
:app:kaptGenerateStubsDebugKotlin
e: C:\Users\Mitchell\StudioProjects\AndroidXDatabindingBug\app\build\tmp\kapt3\stubs\debug\com\github\magneticflux\androidxdatabindingbug\di\AppComponent.java:10: error: [Dagger/MissingBinding] java.util.Map<java.lang.Class<? extends androidx.fragment.app.Fragment>,javax.inject.Provider<dagger.android.AndroidInjector.Factory<? extends androidx.fragment.app.Fragment>>> cannot be provided without an @Provides-annotated method.
public abstract void inject(@org.jetbrains.annotations.NotNull()
^
java.util.Map<java.lang.Class<? extends androidx.fragment.app.Fragment>,javax.inject.Provider<dagger.android.AndroidInjector.Factory<? extends androidx.fragment.app.Fragment>>> is injected at
dagger.android.DispatchingAndroidInjector.<init>(injectorFactories)
dagger.android.DispatchingAndroidInjector<androidx.fragment.app.Fragment> is injected at
dagger.android.support.DaggerApplication.supportFragmentInjector
com.github.magneticflux.androidxdatabindingbug.MyApplication is injected at
com.github.magneticflux.androidxdatabindingbug.di.AppComponent.inject(com.github.magneticflux.androidxdatabindingbug.MyApplication)
:app:kaptDebugKotlin FAILED
FAILURE: Build failed with an exception.
When I replace import dagger.android.support.DaggerApplication
with import dagger.android.DaggerApplication
, the error goes away but I am unable to use DaggerAppCompatActivity
or DaggerFragment
from the support libraries.
A minimal project to reproduce the issue is located here: magneticflux-/AndroidXDagger2Bug, simply try to use the support library features and it will fail to compile.
Issue Analytics
- State:
- Created 5 years ago
- Comments:5
Top Results From Across the Web
Can't resolve Android databinding class - Stack Overflow
By default, a Binding class will be generated based on the name of the layout file, converting it to Pascal case and suffixing...
Read more >Troubleshooting Bindings - Xamarin.Android - Microsoft Learn
Android from binding the Android library and present themselves as error messages in the build log. This guide will provide some tips for ......
Read more >Generated binding classes - Android Developers
The Data Binding Library generates binding classes that are used to access the layout's variables and views. This page shows how to create...
Read more >Jetifier fails to convert Databinding classes, resulting in a ...
android.databinding.* classes) can be used in a AndroidX-based application. This issue prevents us to ship our library for both android.support ...
Read more >Troubleshooting for Xamarin.Android binding project - Allen
This issue can be caused by that you directly build the project after adding the jar package without setting its build action. Binding...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
If you’re using the support application, you need
AndroidInjectionSupportModule
That makes sense, thanks for explaining it; I don’t have much experience with the advanced features of Dagger 2.