dagger2 配置方案.....

来源:互联网 发布:太美医疗 知乎 编辑:程序博客网 时间:2024/06/07 21:13

注意AS版本:

2.33版

  • 在整个项目的build.gradle中加入:
    dependencies {   // other classpath definitions here   classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'}
  • app/build.gradle中分别加入:
    // add after applying plugin: 'com.android.application'  apply plugin: 'com.neenbedankt.android-apt'
    dependencies {  // apt command comes from the android-apt plugin  apt 'com.google.dagger:dagger-compiler:2.2'  compile 'com.google.dagger:dagger:2.2'  provided 'javax.annotation:jsr250-api:1.0'}
  • 3.0版

    在app/build.gradle中dependencies{
    //Dagger2annotationProcessor 'com.google.dagger:dagger-compiler:2.4'compile 'com.google.dagger:dagger:2.4'provided 'javax.annotation:jsr250-api:1.0'
    }

    原创粉丝点击