BarComponent component = Dagger // broken, it can't find the component, so no autocomplete, no dagger.
My build.gradle files look like this:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.0.0'
// Assists in working with annotation processors for Android Studio.
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.4'
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
and my app level build.gradle:
apply plugin: 'com.android.application'
// Assists in working with annotation processors for Android Studio.
apply plugin: 'com.neenbedankt.android-apt'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.example.eflatt.di"
minSdkVersion 19
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.3.0'
// Dagger 2 and Compiler
compile 'com.google.dagger:dagger:2.0.1'
apt "com.google.dagger:dagger-compiler:2.0.1"
// Needed for @Generated annotation (missing in Android API jar)
// No longer needed in dagger >= 2.1-SNAPSHOT (github.com/google/dagger/issues/95)
compile 'javax.annotation:jsr250-api:1.0'
}