Dagger2安装

2016-03-20  本文已影响130人  lyzaijs
  1. 配置APT
buildscript {
repositories {
jcenter()
mavenCentral()
maven {
url "https://oss.sonatype.org/content/repositories/snapshots"
}
}
dependencies {
classpath 'com.android.tools.build:gradle:2.0.0-beta5'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
classpath 'com.frogermcs.androiddevmetrics:androiddevmetrics-plugin:0.3.1'
}
}
allprojects {
repositories {
jcenter()
mavenCentral()
maven {
url "https://oss.sonatype.org/content/repositories/snapshots"
}
}
}
  1. 配置Dagger2
apply plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt'


android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"

    defaultConfig {
        applicationId "frogermcs.io.githubclient"
        minSdkVersion 15
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner 'frogermcs.io.githubclient.MyTestRunner'
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:23.1.1'

    //Dagger 2
    compile 'com.google.dagger:dagger:2.1'
    compile 'com.google.dagger:dagger-producers:2.1'
    apt 'com.google.dagger:dagger-compiler:2.1'


    androidTestCompile 'com.android.support:support-annotations:23.1.1'
    androidTestCompile 'junit:junit:4.12'
    
}
上一篇下一篇

猜你喜欢

热点阅读