Closed ZakTaccardi closed 8 years ago
What is the error?
I don't think it's a dupe of #252 since that discusses types that are generated as part of javac
annotation processing, but my sense is that the Android Data Binding API generates code in a different step. I think @lisawray and/or @ekchang have also had this issue with databinding
There is no default constructor for the generated binding classes so you need to provide it for the graph to figure out how to get it.
@Provides @PerActivity MoreTextBinding provideMoreTextBinding() {
return DataBindingUtil.setContentView(activity, R.layout.more_text); // or DataBindingUtil.inflate() etc
}
I also have a similar problem
public class MainActivity extends BaseActivity<ScreenTestBinding>
- error
C:\Android Projects\TestArchitecture\app\src\main\java\com\example\dmn687\testarchitecture\MainActivity.java Error:(12, 55) error: package com.example.dmn687.testarchitecture.databinding does not exist Error:(16, 48) error: cannot find symbol class ScreenTestBinding C:\Android Projects\TestArchitecture\app\src\main\java\com\example\dmn687\testarchitecture\BaseActivity.java Error:(9, 55) error: package com.example.dmn687.testarchitecture.databinding does not exist Error:(23, 15) error: cannot find symbol class ScreenTestBinding where T is a type-variable: T extends Object declared in class BaseActivity
Where ScreenTestBinding - generated class extends android.databinding.ViewDataBinding
If use public class MainActivity extends BaseActivity<ViewDataBinding>
- all ok
Dagger2 generates code. The DataBinding library generates code. Bad things (build failure) happen when dagger2 needs to @Provides the generated binding classes
See the MainActivityModule.java file.
Full code demonstrating this compilation error can be found here: https://code.google.com/p/android/issues/detail?id=203853
Could be a duplicate of https://github.com/google/dagger/issues/252 (but if so this issue needs to be re-opened)