Android Studio 3.0 error: android-apt is incompatible - android

I'm new to Android development and got a legacy project. So I installed the newest version of Android Studio and opened it.
When I try to build it, I get this error:
Error:android-apt plugin is incompatible with the Android Gradle plugin. Please use 'annotationProcessor' configuration instead.
I've trying the solutions shown in these thread, but it did not work.
I don't have any android-apt reference on my grandle build script.
Many of compile packages are shown as outdated. But when I follow Android's studio suggestion to update reference, I get errors saying the package was not found.
As I said, I'm new to Android Studio World, so I'm a little lost with all these stuff.
This is my build.gradle (Module: app):
apply plugin: 'com.android.application'
apply plugin: 'me.tatarka.retrolambda'
apply plugin: 'realm-android'
android {
compileSdkVersion 24
buildToolsVersion "24.0.2"
defaultConfig {
applicationId "xxxxxxxxxxxx"
minSdkVersion 19
targetSdkVersion 24
versionCode 123
versionName "1.2.3"
manifestPlaceholders = [HOCKEYAPP_APP_ID: "xxxxxxxxxxxxxxxxxxxxx"]
//For Test
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
packagingOptions {
exclude 'META-INF/services/javax.annotation.processing.Processor'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile('com.mikepenz:materialdrawer:4.6.4#aar') {
transitive = true
}
//For Test
androidTestCompile 'com.android.support:support-annotations:24.2.1'
//noinspection GradleCompatible
androidTestCompile 'com.android.support.test:runner:0.5'
androidTestCompile 'com.android.support.test:rules:0.5'
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2'
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.android.support:design:24.2.1'
compile 'com.android.support:cardview-v7:24.2.1'
compile 'com.android.support:recyclerview-v7:24.2.1'
compile 'com.android.support:support-v4:24.2.1'
compile 'com.android.support:support-v13:24.2.1'
compile 'com.squareup.retrofit2:retrofit:2.0.0-beta4'
compile 'com.squareup.retrofit2:converter-gson:2.0.0-beta4'
compile 'com.squareup.okhttp3:okhttp:3.1.2'
compile 'com.jakewharton:butterknife:7.0.1'
compile 'com.p_v:flexiblecalendar:1.1.4'
compile 'br.com.zbra:android-linq:1.0.1'
compile 'com.google.android.gms:play-services-maps:9.4.0'
compile 'com.github.PhilJay:MPAndroidChart:v2.1.6'
compile 'com.cardiomood.android:android-widgets:0.1.1'
compile 'com.github.thorbenprimke:realm-recyclerview:0.9.14'
compile 'net.hockeyapp.android:HockeySDK:4.0.0'
}
This is my build.gradle (Project: MyApp):
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'me.tatarka:gradle-retrolambda:3.2.3'
classpath "io.realm:realm-gradle-plugin:0.88.3"
}
}
allprojects {
repositories {
jcenter()
mavenCentral()
maven { url "https://jitpack.io" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}

The third party android-apt plugin is no longer supported. You should switch to the built-in annotation processor support, which has been improved to handle resolving dependencies lazily.
When using the Android plugin 3.0.0, you must add annotation processors to the processor classpath using the annotationProcessor dependency configuration, as shown below:
dependencies {
...
annotationProcessor 'com.google.dagger:dagger-compiler:<version-number>'
}
Please read the full migration guide to Android Gradle Plugin 3.0.0 at https://developer.android.com/studio/build/gradle-plugin-3-0-0-migration.html
Retrolambda is no longer needed. New Android Gradle Plugin supports Java 8 language features. Read more here.
Assuming you followed the migration guide the error is caused by old Realm plugin.
Realm plugin manages all Realm dependencies behind the scenes. This also means that its old version does not support new tools.
annotationProcessor configuration is first supported in Realm 2.2.0 as seen in the changelog:
Enhancements
Added support for the annotationProcessor configuration provided by Android Gradle Plugin 2.2.0 or later. Realm plugin adds its annotation processor to the annotationProcessor configuration instead of apt configuration if it is available and the com.neenbedankt.android-apt plugin is not used. In Kotlin projects, kapt is used instead of the annotationProcessor configuration (#3026).
Actually you have two options:
update your Realm to at least 2.2.0, or
go back to Android Gradle Plugin 2.3.3.

Related

Android Studio 3.0 Warning: Using incompatible plugins for the annotation processing

After update Android Studio to 3.0 version I have warning:
Error:android-apt plugin is incompatible with the Android Gradle plugin. Please use 'annotationProcessor' configuration instead.
I tried to rewrite my gradle source ,but I still have a warning.
Here is a source
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
classpath 'io.realm:realm-gradle-plugin:0.89.+'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.syncapp"
minSdkVersion 21
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
testImplementation 'junit:junit:4.11'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
implementation 'com.android.support:support-v4:27.0.1'
implementation 'com.android.support:appcompat-v7:27.0.1'
implementation 'com.android.support:design:27.0.1'
compile 'org.greenrobot:eventbus:3.1.1'
compile 'com.google.code.gson:gson:2.6.2'
compile 'com.squareup.retrofit2:retrofit:2.1.0'
compile 'com.squareup.retrofit2:converter-gson:2.1.0'
compile 'com.squareup.okhttp:okhttp:2.7.5'
compile 'com.squareup.okhttp:mockwebserver:2.7.5'
compile 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
compile 'com.google.dagger:dagger:2.4'
annotationProcessor 'com.google.dagger:dagger-compiler:2.4'
}
apply plugin: 'realm-android'
As you can see,in my project I'm using butterknife,dagger,okhttp,retrofit2 and eventbus support libraries
Any solution? I can't run my app
Thanks
Remove apt plugin from your build.gradle file. And wherever in dependency you are using apt replace it with annotationProcessor. Moreover update your realm dependency version to 4.1.1 as well.
Did you have a look at this link?
Basically:
If you are experiencing issues migrating to the new dependency resolution >strategy, you can restore behavior to that of Android plugin 2.3.0 by setting >includeCompileClasspath true.
android {
...
defaultConfig {
...
javaCompileOptions {
annotationProcessorOptions {
includeCompileClasspath false
}
}
}
}
then you can opt to remove the Apt plugin to make the project cleaner but consider that should not affect according to the official documentation
android-apt plugin users: This behavior change currently does not affect the >android-apt plugin. However, the plugin will not be compatible with future >versions of the Android plugin for Gradle
Also when yuo migrate to Android Studio 3.0 you should not use compile but implementation for every dependency
What also you should do is to try to upgrade or downgrade the annotation processor dependecies you have with Dagger or Butterknife, if does not work try to remove Butterknife(but I am not sure about that if the Dagger one is enough, anyway you should not need).

Update Android Studio 3.0, error Sync Gradle

I just install from zero Android Studio 3 and clone my project which doesn't use Android Studio 3 before. I tried to compile but gradle couldn't sync correctly.
I'm using gradle 4.3 because I search my problem on other post, but couldn't find how to fix. This is my gradle file :
buildscript {
repositories {
jcenter()
mavenCentral()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
classpath "io.realm:realm-gradle-plugin:2.1.1"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
mavenCentral()
maven { url "https://maven.google.com" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
And app/gradle file :
apply plugin: 'com.android.application'
apply plugin: 'realm-android'
android {
compileSdkVersion 26
buildToolsVersion '26.0.2'
lintOptions {
disable 'InnerclassSeparator'
}
defaultConfig {
applicationId "fr.laway.dev.laway"
minSdkVersion 21
targetSdkVersion 26
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile project(path: ':laway_data', configuration: 'default')
compile 'uk.co.chrisjenx:calligraphy:2.2.0'
compile 'com.android.support:appcompat-v7:26.1.0'
compile 'com.android.support:design:26.1.0'
compile 'com.android.support:recyclerview-v7:26.1.0'
compile 'com.android.support:cardview-v7:26.1.0'
compile 'com.google.code.gson:gson:2.8.0'
compile 'com.github.clans:fab:1.6.4'
compile 'com.aurelhubert:ahbottomnavigation:1.5.1'
compile 'com.android.support:support-v4:26.1.0'
compile 'com.squareup.retrofit2:retrofit:2.1.0'
compile 'com.android.support:multidex:1.0.2'
compile 'com.facebook.android:facebook-android-sdk:4.27.0'
compile 'com.google.android.gms:play-services-auth:11.4.2'
compile 'com.google.gms:google-services:3.1.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
}
Finally, my errors :
Is something missing in my gradle file?
I don't know why it's related but I just update my realm library :
classpath "io.realm:realm-gradle-plugin:4.1.1"
This was enough for finish to compile and remove all errors. Gradle still is very mysterious for me x)
From the error, gradle complaining this:
android-apt plugin is incompatible with the Android plugin. Please use
'annotationProcessor' configuration instead.
From the documentation:
Use the annotation processor dependency configuration
In previous versions of the plugin, dependencies on the compile classpath were automatically added to the processor classpath. That is, you could add an annotation processor to the compile classpath and it would work as expected. However, this causes a significant impact to performance by adding a large number of unnecessary dependencies to the processor.
When using the Android plugin 3.0.0, you must add annotation processors to the processor classpath using the annotationProcessor dependency configuration, as shown below:
dependencies {
...
annotationProcessor 'com.google.dagger:dagger-compiler:<version-number>'
}
You need to using annotationProcessor in your laway_data module build.gradle.

Error:Cannot change dependencies of configuration ':app:_debugAnnotationProcessor' after it has been resolved

Gradle Project Refresh Failed
After I added KenBurnsView Library to build.gradle on app level. When I try to sync the gradle it failed.
build.gradle (app level)
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.0"
defaultConfig {
applicationId "com.sample.ac"
minSdkVersion 16
targetSdkVersion 24
versionCode 1
versionName "1.0_dev"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
jackOptions {
enabled true
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
repositories {
jcenter()
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.0.1'
compile 'com.android.support:design:25.0.1'
compile 'com.android.support:recyclerview-v7:25.0.1'
compile 'com.android.support:cardview-v7:25.0.1'
//ButterKnife for view injector
compile 'com.jakewharton:butterknife:8.4.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.4.0'
// EventBus for passing data between activities and fragments
compile 'org.greenrobot:eventbus:3.0.0'
//Material Loading Circular Progress Bar with white background
compile 'com.lsjwzh:materialloadingprogressbar:0.5.8-RELEASE'
//GSON for parsing JSON into Java Object and vice versa
compile 'com.google.code.gson:gson:2.6.2'
//For Image Loading from network
compile 'com.github.bumptech.glide:glide:3.7.0'
//SLiding up Panel Layout for Music Player
compile 'com.sothree.slidinguppanel:library:3.3.0'
//For Network Calling
compile 'com.mcxiaoke.volley:library:1.0.19'
//ViewPagerIndicator
compile 'com.romandanylyk:pageindicatorview:0.0.7'
//Google Play Services
compile 'com.google.android.gms:play-services-auth:10.0.0'
compile 'com.google.android.gms:play-services-plus:10.0.0'
compile 'com.google.android.gms:play-services-identity:10.0.0'
compile 'com.google.android.gms:play-services-base:10.0.0'
compile 'com.google.android.gms:play-services-location:10.0.0'
compile 'com.google.android.gms:play-services-maps:10.0.0'
compile 'com.google.android.gms:play-services-gcm:10.0.0'
//Ken Burns Effect for Image Background
compile 'com.flaviofaria:kenburnsview:1.0.7'
//Material Search View
// compile 'com.miguelcatalan:materialsearchview:1.4.0'
compile project(':searchlibrary')
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
build.gradle (project level)
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.2'
classpath 'com.google.gms:google-services:3.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
mavenCentral()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I got it when trying to add a dependency to "com.android.support.constraint:constraint-layout:1.0.0-beta4" for an android training class.
I managed to get past it and it did involve Jack, as #Scott suspected.
Got past it by:
commenting out the added dependency, the jackOptions enable true block, and the compileOptions block, where I had it compatible with 1.8.
Sync/Clean/Rebuild Gradle (whichever it is, I'm still learning)
Uncomment the added dependency, sync/rebuild gradle again
Uncomment the jackOptions and compileOptions blocks, sync/rebuild gradle again
At that point, it worked for me.
Add it to app build.gradle or project build.module:
repositories {
maven {
url 'https://maven.google.com'
}
}
I get this problem when I add 'constraint-layout' dependency and I find out answer in ofical manual: https://developer.android.com/training/constraint-layout/index.html
I think it will help you!
After hours of trying everything, this worked for me -> Upgrade com.google.gms:google-services to latest version.
Case : added
dataBinding {
enabled = true
}
Solution : In project gradle classpath changed
'com.google.gms:google-services:3.3.1'
to
'com.google.gms:google-services:4.0.1' (latest version)
I upgraded gradle and a google-play-services lib and didn't realize that you are apparently required to remove apply plugin: 'com.google.gms.google-services' at the end of app module's build.gradle.
Removing it solved this for me.
The docs were a little misleading. Removing apply plugin: 'com.google.gms.google-services' did indeed solve this problem, but the line is still required for Firebase to work actually.
After some more playing around, I noticed that also removing the dataBinding{enabled true} made the error go away. But again, also this is not a solution.
In the end I had to downgrade to com.android.tools.build:gradle:3.0.0 - which again is obviously not a solution because you are missing out on e.g. InstantRun, but at least it builds.
The whole issue was introduced after an update to Android Studio 3.1.2, so I assume that downgrading again would solve it.
I come across this question too , i added maven in repositories{...} and a dependency in dependencies {...} of module's build.gradle .
I find the reason , because Android Studio can't load the dependency from maven repository . then instead compile, i copy the jar to module , sync ,the error is disappeared.
In summary , you can check out the dependency is loaded or not at "C:\Users\wjj.gradle\caches\modules-2\files-2.1".
I hope it can help you!

Move toward j8 and Jack. Gradle sync Error

Hello guys I desire to use lamba functions available on Java8, hence I had to apply new toolchain Jack. Unfortunatelly when I did some unexpected error arise. Namely:
Could not get unknown property 'classpath' for task ':app:transformJackWithJackForProdDebug' of type com.android.build.gradle.internal.pipeline.TransformTask.
I'm using in my project library like
In project I'm using lib like:
dagger
RxJava
I know that dagger causes error, however since july dagger2 has became available to use.
I use
Android Studio 2.1.2
Gradle Version 2.14.1
Android Plugin Version
2.2.0-alpha7
Please look at my gradle
project/buidl.gradle
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.0-alpha7'
// classpath 'com.android.tools.build:gradle:2.2.0-alpha3'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
app/build.gradle
apply plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt'
android {
compileSdkVersion 24
buildToolsVersion '24.0.0'
defaultConfig {
applicationId "XXX"
minSdkVersion 19
targetSdkVersion 21
versionCode 1
versionName "1.0"
jackOptions{
enabled true
}
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
minifyEnabled false
versionNameSuffix "_debug"
}
}
productFlavors{
dev{
minSdkVersion 21
}
prod {
minSdkVersion 19
}
}
compileOptions{
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
ext {
JUNIT_VERSION = '4.12'
DAGGER_VERSION = '2.4'
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile "junit:junit:$JUNIT_VERSION"
compile project(path: ':android_mvp')
// dependency injection
apt 'com.google.dagger:dagger-compiler:2.0' // 2.5 causes error
compile 'com.google.dagger:dagger:2.0'
provided 'javax.annotation:jsr250-api:1.0'
annotationProcessor 'com.google.dagger:dagger-compiler:2.0'
// for new Jack and Jill gradle 2.2.+
// rx java
compile 'io.reactivex:rxjava:1.1.6'
compile 'io.reactivex:rxandroid:1.2.1'
// RxAndroid providing Android Scheduler
compile 'io.reactivex:rxjava-joins:0.22.0'
// view
compile 'com.android.support:appcompat-v7:24.1.1'
compile 'com.android.support:design:24.1.1'
compile 'com.android.support:recyclerview-v7:24.1.1'
compile 'com.android.support:cardview-v7:24.1.1'
// rest / stream
compile 'com.squareup.retrofit2:retrofit:2.0.0-beta4'
compile 'com.squareup.retrofit2:adapter-rxjava:2.0.0-beta4'
compile 'com.squareup.retrofit2:converter-gson:2.0.0-beta4'
compile 'com.squareup.okhttp3:logging-interceptor:3.2.0'
compile 'com.squareup.okhttp3:okhttp:3.2.0'
compile 'com.neovisionaries:nv-websocket-client:1.29'
// time
compile 'net.danlew:android.joda:2.9.3'
}
EDITED
Ok as I've read Lambdas are currenty not supported in project
module, so as you want to use lambdas in project modules - just
forget.
So I've removed my own module and copied whole code into main app module
I ended up with successfully gradle build by removing following code lines from app/build.gradle
apply plugin: 'com.neenbedankt.android-apt'
...
dependency{
apt 'com.google.dagger:dagger-compiler:2.0' // 2.5 causes error
}
However error related with dagger remains, its mean that sometimes project was able to rebuild sometimes its wrote very long stacktrace.
CONCLUSION
After 2,5 years after first j8 release lazy Android team is not able to integrate it. 2,5 year in IT is sooo long, so my programing skils became slowly deprecated! I hope they finish until j9 release!
Had the same issue. Solved by using built in "annotationProcessor" instead of "apt" plugin
https://stackoverflow.com/a/39086683/2282051
remove:
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
apply plugin: 'com.neenbedankt.android-apt'
apt 'com.google.dagger:dagger-compiler:2.0'
and you already have
dependencies {
annotationProcessor 'com.google.dagger:dagger-compiler:2.0'
}
It does the same as the 'apt' plugin does.

android studio 2.2 how to apply dagger2 without android-apt plugin

my project build.gradle
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.0-alpha3'
classpath 'com.google.dagger:dagger-compiler:2.2'
classpath 'com.google.guava:guava:19.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
my module build.gradle
android {
compileSdkVersion 24
buildToolsVersion '24.0.0'
defaultConfig {
applicationId "com.aber.app.acgtalk"
minSdkVersion 19
targetSdkVersion 24
versionCode 1
versionName "1.0"
jackOptions {
enabled true
}
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
ext {
supportLibVersion = '24.0.0'
}
dependencies {
compile 'com.google.dagger:dagger:2.2'
annotationProcessor 'com.google.dagger:dagger-compiler:2.2'
debugAnnotationProcessor 'com.google.dagger:dagger-compiler:2.2'
provided 'javax.annotation:jsr250-api:1.0'
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile "com.android.support:appcompat-v7:${supportLibVersion}";
compile "com.android.support:recyclerview-v7:${supportLibVersion}";
compile "com.android.support:design:${supportLibVersion}";
compile "com.android.support:support-v13:${supportLibVersion}";
compile "com.android.support:support-annotations:${supportLibVersion}";
compile "com.android.support:gridlayout-v7:${supportLibVersion}";
compile "com.android.support:cardview-v7:${supportLibVersion}";
compile "com.android.support:preference-v14:${supportLibVersion}";
compile 'com.squareup.okhttp3:okhttp:3.2.0';
compile 'com.google.code.gson:gson:2.6.2'
compile 'com.squareup.retrofit2:retrofit:2.0.2'
compile 'com.squareup.retrofit2:converter-gson:2.0.2'
}
what's wrong with this,how to using the annotationProcessor function within the Android studio 2.2 ,how to conifg the dagger2 annotation processor correctly?
new Jack annotations processors
Yes, with android gradle plugin 2.2.0 release, the android-apt plugin is no longer needed for annotation processing. The apt function was included in the latest android gradle plugin. It's called annotationProcessor now which was what you had in your build script. However, there were a few misconfigured stuff in the script.
First of all, the dagger compiler should not be added to classpath. So remove this line: classpath 'com.google.dagger:dagger-compiler:2.2'.
And you are using android gradle plugin version alpha3. Try to use the latest version, so change to classpath 'com.android.tools.build:gradle:2.2.2'.
The dependency declaration block looks legit. So try to make the above changes to see if it would work.
You're incorretly insert plugin classpath. Remove the following line in your project build:
classpath 'com.google.dagger:dagger-compiler:2.2'
and insert:
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
Then in your module build.gradle, add the following code after apply plugin android application:
// add after applying plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt'
Add the following line to your 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'
For more information read here:
https://github.com/codepath/android_guides/wiki/Dependency-Injection-with-Dagger-2
and for sample project, visit here:
https://github.com/spirosoik/AndroidArchitecturePadawans

Categories

Resources