So happenned that I have a main app module
build.gradle
dynamicFeatures = [":myFeature"]
viewBinding {
enabled = true
}
AdroidManifest.xml
package="com.mydomain.testproject"
With some common layouts which I'm using across the app
eq: app/res/error_view.xml
And I have the dynamic feature files
build.gradle
viewBinding {
enabled = true
}
AdroidManifest.xml
package="com.mydomain.testproject.myFeature"
myfeature_fragment.xml
<include
android:id="@+id/error_view"
layout="@layout/error_view"
android:visibility="gone" />
MyFeatureFragment.kt
binding = MyFeatureFragmentBinding.bind(view)
and here comes the problem .
When i try to access the binding.errorView
AS shows an error Cannot access class 'com.mydomain.testproject.myFeature.databinding.ErrorViewBinding'. Check your module classpath for missing or conflicting dependencies
The strange thing is when I check the generated MyFeatureFragmentBinding
class it contains the following
@NonNull
public final View errorView;
So I guess AS knows more than it shows for me.
Also I found in the main module's generated classes the original ErrorViewBinding
and OFC it's working flawlessly from there.
Someone managed to reference a common layout from another feature-module ?
or how can I enforce the type of the generated common view binding?