How do I share dependencies that use annotationPro

2019-06-28 05:12发布

问题:

I have an Android application module (A) and an Android library module (B). Both (A) and (B) contain these same dependencies:

dependencies {
   implementation 'com.jakewharton:butterknife:8.8.1'
   annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
}

However in my project the module (A) is depending on module (B) so I did search on the stack overflow about how could I implement Don't Repeat Yourself design pattern so that I will include those dependencies only in the module (B) and I found this useful but I didn't find how could I make this dependency

annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1

shared between those two modules so how could I do that?