I am using Gradle to build an Android Studio project. I am using auto-value in one of my modules but for some reason, any version of auto-value higher than 1.5.3 causes a compilation failure.
My dependency in build.gradle for the module looks like this:
annotationProcessor 'com.google.auto.value:auto-value:1.5.3'
If I just change that 1.5.3 to 1.6.5, I get the following error when building (syncing works fine):
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.
- auto-value-1.5.3.jar (com.google.auto.value:auto-value:1.5.3)
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.
I even tried using the recommended instructions on the documentation:
api "com.google.auto.value:auto-value-annotations:1.6.2"
annotationProcessor "com.google.auto.value:auto-value:1.6.2"
Any clue what to do here?
Related
while generating apk getting this error i have already tried upadting the pugins also as it was recommended
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.
- icepick-processor-3.2.0.jar (frankiesardo:icepick-processor:3.2.0)
- auto-service-1.0-rc2.jar (com.google.auto.service:auto-service:1.0-rc2)
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.
You should explicitly add annotation processors in gradle. Putting the following in your gradle dependencies should fix it:
annotationProcessor 'frankiesardo:icepick-processor:3.2.0'
annotationProcessor 'com.google.auto.service:auto-service:1.0-rc2'
I made a library, but when I tried to use it with implementation 'com.example:mylibrary:1.3.0' in my app's build.gradle, I keep getting an error saying the ConstraintLayout dependency (which the library uses but not the app) is not found. However it was explicitly defined in the library's build.gradle with implementation.
When I ran gradlew app:dependencies on the terminal, it shows that the library has no dependencies, even though it actually has 2. This seems to be the source of the problem, Gradle can't detect the dependencies of the library.
I didn't run into this problem for a while but when I decided to remove the ConstraintLayout dependency from my app an error appears during build.
When you're using implementation for the dependencies in your library, the project which is dependent with it will not see the dependencies. You need to use api instead of implementation.
Previously my gradle used to look like this and worked fine (apart from few registered bugs)
implementation 'com.dji:dji-sdk:4.3.2'
Now, after changing to
implementation 'com.dji:dji-sdk:4.4.0'
the Camera and other files cannot be recognized anymore. I am attaching a screenshot of the unrecognized imports.
However when I am trying to add
//dji-drones-sdk
implementation 'com.dji:dji-sdk:4.4.0'
provided 'com.dji:dji-sdk-provided:4.4.0'
I am getting "could not download dji-sdk-provided.jar"
Screenshot attached
All the examples and github codes are in version 4.3.2. Can anyone help me out?
Here is the link to the dji sdk
I have found the issue. After Gradle 3.4, the "provided" is replaced by "compileOnly"
I quote,
Gradle adds the dependency to the compilation classpath only (it is not added to the build output). This is useful when you're creating an Android library module and you need the dependency during compilation, but it's optional to have present at runtime. That is, if you use this configuration, then your library module must include a runtime condition to check whether the dependency is available, and then gracefully change its behavior so it can still function if it's not provided. This helps reduce the size of the final APK by not adding transient dependencies that aren't critical. This configuration behaves just like provided (which is now deprecated).
Hence using compileOnly in place of provided will do the trick.
Here is a link to the gradle changes documentation
Error:Execution failed for task ':app:javaPreCompileFreeDebug'.
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.
- realm-android-0.80.0.jar (io.realm:realm-android:0.80.0)
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.
I using lombok on some project, and with the new Android Studio 2.4 Update now (Preview) I get this strange error:
What went wrong: Execution failed for task
':core:javaPreCompileRelease'. 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.
- lombok-1.16.16.jar 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.
I already tried:
annotationProcessor "org.projectlombok:lombok:1.16.16"
but has no effect.
I also tested:
android.defaultConfig.javaCompileOptions.annotationProcessorOptions.includeCompileClasspath
= true
But also has no effect.
Also checked the support page for further information but with no luck, anyone of you possibly?
https://developer.android.com/studio/preview/features/index.html?utm_source=android-studio#annotationProcessor_config
Update:
provided "org.projectlombok:lombok:1.16.16" // keep
annotationProcessor "org.projectlombok:lombok:1.16.16" // add this
Just worked perfectly, but I have two Android Studio modules, and two build.gradle files.
The error log just changed a bit (module prefix), and I thought the fix didn't work.
But after applying the fix to both build.gradle files everything worked perfectly.
I had the same problem but needed a slightly different fix (although the idea came from the accepted answer above - https://stackoverflow.com/a/43820494/1777346)
Turned out I already had the provided and annotationProcessor in both build.gradle files.. but, I also had a compile entry. Removing it fixed this issue for me:
compile 'org.projectlombok:lombok:1.16.16' // remove this
provided 'org.projectlombok:lombok:1.16.16'
annotationProcessor "org.projectlombok:lombok:1.16.16"
Just figured I'd add my findings in case it helps anyone. I'm using Android Studio 3.0 Canary 4 and gradle:3.0.0-alpha4 in my unending quest to get build times down.. which never seems to pay off :)