After update Android Studio to 2.3 version I have warning:
Warning:Using incompatible plugins for the annotation processing:
android-apt. This may result in an unexpected behavior.
Any solutions? My app stopped working...
Your app level gradle dependencies should include (as per butterknife website instructions):
compile 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
You can remove the line :
apply plugin: 'com.neenbedankt.android-apt'
Annotation Processing became available in Android Gradle plugin (2.2 and later) so there is now no need to use the above plugin anymore if using this version of gradle or greater.
If you'd like to know how to turn annotation processing off and on and AS the setting is in :
Settings > Build, Execution, Deployment > Compiler > Annotation Processors
In my project I use, among other things, Butter Knife and Immutables. After adding Immutables I got the following warning
Warning:Using incompatible plugins for the annotation processing:
android-apt. This may result in an unexpected behavior.
and ButterKnife stopped working.
My configuration was as follows:
build.gradle (Project: MyApplication)
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.1'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
}
}
build.gradle (Module: app)
apply plugin: 'com.android.application'
apply plugin: 'android-apt'
...
dependencies {
...
// Butter Knife
compile 'com.jakewharton:butterknife:8.5.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1'
// Immutables
apt 'org.immutables:value:2.4.4'
provided 'org.immutables:value:2.4.4'
provided 'org.immutables:builder:2.4.4'
provided 'org.immutables:gson:2.4.4'
}
After changing
annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1'
to
apt 'com.jakewharton:butterknife-compiler:8.5.1'
warning disappeared and everything works as it should.
UPDATE
As Mark said, an annotation processor was included in the Gradle version 2.2 , so there is no reason to provide an extra one.
So:
1) Remove the class path for the apt from the build.gradle (Project: MyApplication)
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
2) Remove the plug in from the build.gradle (Module: app)
apply plugin: 'android-apt'
3) Change the dependencies from apt to the new annotationProcessor
annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1'
annotationProcessor 'org.immutables:value:2.4.4'
To add to #Milan's answer, if you used the hotchemi permissiondispatcher library in your app level gradle file then you should replace it as follows:
Replace
apt 'com.github.hotchemi:permissionsdispatcher-processor:2.4.0'
with
annotationProcessor 'com.github.hotchemi:permissionsdispatcher-processor:2.4.0'
At Project Gradle buildscript --> dependencies block, remove the second classpath line :
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
// 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
}
And at app Gradle dependencies block, change these lines, use api and annotationProcessor :
api 'com.google.dagger:dagger:2.19'
annotationProcessor 'com.google.dagger:dagger-compiler:2.19'
Also, remove this one:
//apply plugin: 'com.neenbedankt.android-apt'
Related
I have a modification I want to do to android settings in order for it to be compatible with older versions so I added to the dependencies
implementation "com.android.support:recyclerview-v7:$support_version"
//implementation "com.android.support:appcompat-v7:$support_version"
This produced the error
Could not get unknown property 'support_version' for object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
I added the following to the top of the build.gradle file also
plugins {
id 'com.android.application'
id 'kotlin-android'
id 'kotlin-android-extensions'
}
Please what am I doing wrong?
In order to progress I had to comment the two lines out so that the android can compile but I need to make it backward compatible in production.Android
Try with below dependency In App gridle File
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
Project level Gridle File
buildscript {
ext.kotlin_version = '1.4.20'
repositories {
google()
jcenter()
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
}
com.android.support is deprecated. Replace by androidx
implementation "androidx.recyclerview:recyclerview:1.2.0-beta01"
implementation "androidx.appcompat:appcompat:1.3.0-alpha02"
You are missing the "support_version" variable in your Gradle script.
Try this:
add this to your build.gradle
ext.main = ['support_version' : 'X.X.X']
and in your dependency structure, you can add.
implementation "com.android.support:recyclerview-v7:${main.support_version}"
NB: make sure you have valid version number.
I get the following errors when trying to execute my project:
Error:Execution failed for task ':app:javaPreCompileDebug'.
Annotation processors must be explicitly declared now. The following dependencies on the compile classpath are found to contain
annotation processor. Please add them to the annotationProcessor
configuration.
- butterknife-7.0.1.jar (com.jakewharton:butterknife:7.0.1) Alternatively, set
android.defaultConfig.javaCompileOptions.annotationProcessorOptions.includeCompileClasspath
= true to continue with previous behavior. Note that this option is deprecated and will be removed in the future. See
https://developer.android.com/r/tools/annotation-processor-error-message.html
for more details.
Please don't mark this question as duplicate as other question regrading this, here, is for lombok, which I'm not using.
As the error says, you need to use annotationProcessor in your app build.gradle. Afaik, you need to upgrade the ButterKnife library to version 8.8.1. You need to use something like this:
dependencies {
compile 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
}
Please check Android studio 3.0 butterknife error issue for the details.
Going through the following process makes my problem solved.
In the build.gradle(module app)
apply the plugin:
apply plugin: 'com.jakewharton.butterknife'
Add the following lines in the dependencies section:
annotationProcessor 'com.jakewharton:butterknife-compiler:8.7.0'
implementation 'com.jakewharton:butterknife:8.7.0'
In the build.gradle(Project:projectName), add the classPath in the dependencies like this :
classpath 'com.jakewharton:butterknife-gradle-plugin:8.4.0'
It will fix this issue.
In case if not then add maven:
maven {
url 'https://maven.google.com'
}
Adding these two line in app/build.gradle
dependencies {
compile 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
}
It worked for me
Based on ButterKnife lib, I upgrade to new version 8.5.1. I used
compile 'com.jakewharton:butterknife:8.5.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1'
But it warns me in my Android Studio 2.3. And ButterKnife doesn't work(cannot bind view).
Warning:Using incompatible plugins for the annotation processing:
android-apt. This may result in an unexpected behavior.
I change annotationProcessor to apt (I had plugin apply plugin: 'com.neenbedankt.android-apt' in my gradle) and it works as old version without warning (I used apt for old version 8.4.0)
compile 'com.jakewharton:butterknife:8.5.1'
apt 'com.jakewharton:butterknife-compiler:8.5.1'
I think Android Studio 2.3 is incomatible with Annottaion processing. I searched and found to enable Annotation Processors in Android Studio 2.2 but cannot find in Android Studio 2.3
Settings > Build, Execution, Deployment > Compiler > Annotation
Processors
Anyone can explain this problem? Thanks!
kindly
//apply plugin: 'com.neenbedankt.android-apt' <--remove this
apply plugin: 'com.jakewharton.butterknife' <-- add this
dependencies {
//classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8' <-- remove this
classpath 'com.jakewharton:butterknife-gradle-plugin:8.5.1' <-- add this
}
then in app dependencies
//Butterknife
compile 'com.jakewharton:butterknife:8.5.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1'
Simple and easy. Just add these lines to your build.gradle
compile 'com.jakewharton:butterknife:8.5.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1'
An annotation processor was included in the Gradle version 2.2, so there is no reason to provide an extra one.
Check my updated answer here.
Two warnings show up when I try to build my project:
Warning:Using incompatible plugins for the annotation processing: android-apt. This may result in an unexpected behavior.
and also at the end of all the binding errors:
Warning:The following options were not recognized by any processor: '[android.databinding.artifactType, android.databinding.printEncodedErrors, android.databinding.minApi, android.databinding.isTestVariant, android.databinding.enableDebugLogs, android.databinding.sdkDir, android.databinding.bindingBuildFolder, android.databinding.enableForTests, android.databinding.modulePackage, android.databinding.generationalFileOutDir, android.databinding.xmlOutDir]'
I tried to enable annotation processors and removed all apt reference and changed this:
apt 'com.jakewharton:butterknife-compiler:8.2.1'
to this:
annotationProcessor 'com.jakewharton:butterknife-compiler:8.2.1'
but it didn't work.
Just replace apt with annotationProcessor in your build.gradle file.
And remove apt plugins wherever you see them.
You can down version of tools build gradle from 2.3.0 to 2.2.3 to avoid warning like that
classpath 'com.android.tools.build:gradle:2.2.3'
Android apt is no longer supported in Android studio 2.3
see https://bitbucket.org/hvisser/android-apt/issues/73/no-longer-compatible-with-gradle-at-v230
after i update. i also have this kind of situation. Remove any apt like "com.neenbedankt.gradle.plugins:android-apt:1.8" from your dependencies classpath
but before that.. please invalidate cache/restart AS and clean gradle.
then
dependencies {
classpath 'com.jakewharton:butterknife-gradle-plugin:8.5.1'
}
then
apply plugin: 'com.jakewharton.butterknife'
then
compile "com.jakewharton:butterknife:8.5.1",
annotationProcessor "com.jakewharton:butterknife-compiler:8.5.1"
the lastly..put this in last app module
configurations.all {
resolutionStrategy {
force "com.android.support:support-annotations:25.2.0"
}
}
Can't use google maps because of above said error. Anyone find the same issue ?
Make sure that the following line is at the end of the app build.gradle file:
apply plugin: 'com.google.gms.google-services'
Mine was on the top and gradle was defaulting to 8.3.0 instead of what was specified: 8.4.0
My build.gradle files are the same as the ones in the Version conflict updating to 8.4.0
As those previous anweres are only part-wise complete.
Here are my three steps which worked fine for me:
Put this to the end of your apps build.gradle
apply plugin: 'com.google.gms.google-services'
Set your projects build.gradle dependencies to
'classpath 'com.google.gms:google-services:2.0.0-alpha5'
Set Gradle Version to 2.10
Android Studio: File > Project Structure > Project
#redsonic's answer worked for me.. By simply moving apply plugin:
'com.google.gms.google-services' after the dependecies in
build.gradle (Module: app)
I'm using Android Studio 1.5.1 with Gradle version 2.10
In case you are using Gradle version older than 2.10 you'll also need to update that by selecting the ProjectName or app directory in the Project tool Windows and pressing F4. This will open Project Structure window, select Project from the menu and update Gradle version to 2.10. Press OK (Android Studio will download it in background).
build.gradle (Project: ProjectName)
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
classpath 'com.google.gms:google-services:2.0.0-alpha6'
}
build.gradle (Module: app)
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.google.android.gms:play-services:8.4.0'
}
apply plugin: 'com.google.gms.google-services'
This is a slight variant of #Lord Flash's answer:
For me it wasn't necessarily that I should place the google services plugin at the bottom of the file it was that it should come before the com.android.application plugin.
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.android.application'
Also there are newer binaries than the alpha variants for google-services
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.google.gms:google-services:2.0.0-beta6'
}
}
I'm sure there will be newer ones soon. I found the list of variants here
follow all the steps at this link Add App Invites to Your App
use this : compile 'com.google.android.gms:play-services-appinvite:8.4.0'
instead of this : compile 'com.google.android.gms:play-services:8.4.0'
please follow all the steps and then build the project
hope thats help
I had the same problem, and I found that moving:
apply plugin: 'com.google.gms.google-services'
To the bottom of the module app gradle.
and then use:
classpath 'com.android.tools.build:gradle:2.1.0'
classpath 'com.google.gms:google-services:2.1.0'
The problem is that some of your app dependencies that start with com.google.android.gms: have a version that is incompatible your project dependencie classpath 'com.google.gms:google-services:
Check for these on your app build.gradle
compile 'com.google.android.gms:play-services-plus:8.4.0'
compile 'com.google.android.gms:play-services-analytics:8.4.0'
compile 'com.google.android.gms:play-services-gcm:8.4.0'
compile 'com.google.android.gms:play-services-maps:8.4.0'
And for this in your project build.gradle
classpath 'com.google.gms:google-services:1.5.0'
You can update your project build.gradle to use the latest google-services version or your can just change your app dependencies to use the 8.3 version.
// 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.1.0'
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()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
// this should solve the gradle update error if it persists even after following above steps
Make sure that the following line is at the end of the app build.gradle file:
compile 'com.google.android.gms:play-services:11.0.2'
google update there API day by day.Now mine is '11.0.2'
try with the updated API