Could not find the AndroidManifest.xml file, using generation folder after Android Annotations
Asked Answered
T

3

6

I can't run my project after adding the @EActivity Annotation to my class.

This is my Gradle Project:

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        google()
        jcenter()

    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.3.2'
        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 {
        google()
        jcenter()

    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

This is my Gradle Module:app

apply plugin: 'com.android.application'
def AAVersion = '4.2.0'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.example.tasks"
        minSdkVersion 19
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'

    implementation 'com.android.support:support-annotations:28.0.0'

    annotationProcessor "org.androidannotations:androidannotations:$AAVersion"
    implementation "org.androidannotations:androidannotations-api:$AAVersion"
}

After I added the Android Annotations in my Gradle I noticed that my AndroidMannifest didn't get automatically modified (Missing the _ in the activity), and when I add that manually it gets highlighted in red.

If I run the project normally (Without modifying the AndroidMannifest or changing the class to Annotations) it will run normally.

If I add the annotations and modify the Manifest I'll receive the error:

error: Could not find the AndroidManifest.xml file, using generation folder [C:\Users\Asusc\AndroidStudioProjects\Tasks\app\build\generated\source\apt\debug])

Any idea what I might be doing wrong?

Tailstock answered 12/3, 2019 at 22:20 Comment(0)
A
8

You should update to AndroidAnnotations 4.6.0 . This version has Android Gradle Plugin 3.3.+ support.

Azzieb answered 13/3, 2019 at 9:8 Comment(4)
It worked out! I upgraded the AAVersion for 4.6.0 and removed the line implementation 'com.android.support:support-annotations:28.0.0' Thank you!!Friar
didn't worked in my case. AAVersion is 4.6.0 and gradle is 3.5.2.Hereld
@NirojShr Please try to downgrade the Gradle version to 3.4.1.Homophony
I was using AA 4.6.0 and gradle 3.5.3. even though I find it ridiculous that I had to downgrade back to such an older version, gradle 3.4.1 indeed worked.Casement
B
14

In my case, adding this to build.gradle fixed it:

android {
   ...
   defaultConfig {
       ...
       javaCompileOptions {
            annotationProcessorOptions {
            arguments = ["androidManifestFile": "$projectDir/src/main/AndroidManifest.xml".toString()]
            }
        }
    }
}
Barbur answered 17/1, 2020 at 11:22 Comment(2)
Downgrading to gradle 3.4.1 wasn't an option I wanted to consider and this solution came through for me. ThanksElater
Especially when your project contains splits such as flavours, AA has problem to get with this and puting path to the manifest file arbitrally fixes the problem. See more: github.com/androidannotations/androidannotations/issues/2034Whiffen
A
8

You should update to AndroidAnnotations 4.6.0 . This version has Android Gradle Plugin 3.3.+ support.

Azzieb answered 13/3, 2019 at 9:8 Comment(4)
It worked out! I upgraded the AAVersion for 4.6.0 and removed the line implementation 'com.android.support:support-annotations:28.0.0' Thank you!!Friar
didn't worked in my case. AAVersion is 4.6.0 and gradle is 3.5.2.Hereld
@NirojShr Please try to downgrade the Gradle version to 3.4.1.Homophony
I was using AA 4.6.0 and gradle 3.5.3. even though I find it ridiculous that I had to downgrade back to such an older version, gradle 3.4.1 indeed worked.Casement
H
4

If you are using AndroidAnnotations 4.6.0 with Android Gradle Plugin 3.5.+, you can downgrade the Android Gradle Plugin version to 3.4.1 to fix.

classpath 'com.android.tools.build:gradle:3.4.1'
Homophony answered 16/11, 2019 at 5:56 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.