how to fix Android Annotations 4.6.0 compile with android Studio 3.5 and 3.5.0 gradle
Asked Answered
S

3

5

I updated Android studio to 3.5 but there is a problem when I use android annotations

Gradle may disable incremental compilation as the following annotation processors are not incremental: jetified-androidannotations-4.6.0.jar (org.androidannotations:androidannotations:4.6.0).
Consider setting the experimental feature flag android.enableSeparateAnnotationProcessing=true in the gradle.properties file to run annotation processing in a separate task and make compilation incremental

I've put android.enableSeparateAnnotationProcessing=true in the gradle.properties file

Here is a Gradel app Here is a Grade build

but it's say that

INFO: The option setting 'android.enableSeparateAnnotationProcessing=true' is experimental and unsupported. The current default is 'false'.

Could not find the AndroidManifest.xml file

Supernaturalism answered 22/8, 2019 at 6:48 Comment(0)
S
7

I had almost the same problem and couldn't build my app after updating android studio and gradle to 3.5 but according to this answer I added this to my defaultConfig{} in app gradle and problem solved!

javaCompileOptions {
        annotationProcessorOptions {
            arguments = [
                    "androidManifestFile": "$projectDir/src/main/AndroidManifest.xml".toString()
            ]
        }
    }
Snailfish answered 26/8, 2019 at 12:44 Comment(1)
It worked. Hopefully once AA fixes the issue we can get rid of itYoumans
M
3

There is 2 way of fixing this issue

Method One - Use Snapshot version

Current Annotation lib version is 4.6, to fix these error temporary you can use a Snapshot version

add the following URL in Project-level Gradle

buildscript {
repositories {
    maven { url = 'https://oss.sonatype.org/content/repositories/snapshots' }

}

Method Two - Use javaCompileOptions

Add following code in gradle DSL

  defaultConfig {
    javaCompileOptions {
        annotationProcessorOptions {
            arguments = ["resourcePackageName": android.defaultConfig.applicationId]
            arguments = ["androidManifestFile": "$projectDir/src/main/AndroidManifest.xml".toString()]
        }
    }
}

Hope it will work :)

Matrona answered 8/9, 2019 at 7:10 Comment(0)
P
0

AndroidAnnotations does not support Gradle incremental annotation processing, yet. You can still build your app, it only means that incremental compilation time is not as fast as it could be. There is an issue for tracking the implementation of incremental processing.

I suggest not to set android.enableSeparateAnnotationProcessing flag, as it is experimental, can cause other issues, and will slow down your clean builds.

Prestonprestress answered 22/8, 2019 at 7:48 Comment(1)
Thanks!, I solve it by downgrade the gradel to 3.4.0 and in gradle-wrapper.properties file To : intdistributionUrl=https\://services.gradle.org/distributions TO "gradle-5.1.1-all.zip "Supernaturalism

© 2022 - 2024 — McMap. All rights reserved.