I am trying to move a large scale app to view binding. we are using dagger.android at a lot of areas, so i am guessing the View Binding and dagger are not faring well. here is the error i am getting :
Type net.myapp.base.abstracts.vb.BaseFragmentVB_MembersInjector is defined multiple times:
Users/anshsachdeva/Desktop/android/myapp-android/feature/search/build/intermediates/runtime_library_classes_jar/stagingDebug/classes.jar:net/myapp/base/abstracts/vb/BaseFragmentVB_MembersInjector.class, /
Users/anshsachdeva/Desktop/android/myapp-android/feature/flashcard/build/intermediates/runtime_library_classes_jar/stagingDebug/classes.jar:net/myapp/base/abstracts/vb/BaseFragmentVB_MembersInjector.class
Some Context:
The app uses the classic clean architecture, where all the child activities, fragments, etc extend from the base classes . the project is also having multiple feature modules like app
,base
, feature/search
, feature/flashcard
,domain
, etc . The base classes reside in base
module, while the classes extending from them resides in their associated module like feature/search
.
To support view binding, i added some intermediate abstract classes that would act as holders of Viewbinding :passing an inflated view to parent while handling the lifecycle of viewbinding instance and providing safe access to children, both at the same time. i kept those in base class module only.
now everything was working well and the children classes are able to access the base View binding classes, but when i try to build the project, this error occurs. I am not sure why is this happening?
(PS:I work on several branches. the view binding code was in one of the branches. last week i made this code, built it and run , and it was working. Then i switched branches and started working on other things. this week, i come back to the same branch and code does not build )
Thankyou everyone. I changed my build environment from staging to debug and it worked. Now need to work on the newer problem of why the build environment is not working.