項目組件化集成ARouter,Dagger2

在項目公共基礎組件中依賴中添加

api rootProject.ext.dependencies["router"]
api rootProject.ext.dependencies["dagger"]
annotationProcessor rootProject.ext.dependencies["dagger-compiler"]
"router"           : "com.alibaba:arouter-api:1.4.1",
"router-compiler"  : "com.alibaba:arouter-compiler:1.2.2",

"dagger"           : "com.google.dagger:dagger:2.16",
"dagger-compiler"  : "com.google.dagger:dagger-compiler:2.16",

爲什麼用api前面已經講到了,這裏不寫了。當然也有annotationProcessor rootProject.ext.dependencies["router-compiler"]
這個放在功能模塊中。所以在功能模塊中要加

annotationProcessor rootProject.ext.dependencies["router-compiler"]
annotationProcessor rootProject.ext.dependencies["dagger-compiler"]

當然你還要添加那個公共的基礎組件。因爲已經有了api rootProject.ext.dependencies["router"],api rootProject.ext.dependencies["dagger"]

可以公用所以就用再添加了。當然功能組件中別忘了ARouter還需要添加
 

defaultConfig {

    javaCompileOptions {
        annotationProcessorOptions {
            arguments = [AROUTER_MODULE_NAME: project.getName()]
        }
    }
}
前一篇:項目組件化歷程(MVP+dagger2+ARouter)
後篇:項目組件化MVP,Dagger2,ARouter使用

 

 

 

 


 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章