Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 904
Cléo Sousa Avatar asked Dec 01 '22 14:12

Cléo Sousa


1 Answers

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

android {
   ...
   defaultConfig {
       ...
       javaCompileOptions {
            annotationProcessorOptions {
            arguments = ["androidManifestFile": "$projectDir/src/main/AndroidManifest.xml".toString()]
            }
        }
    }
}
like image 90
Alexander Pacha Avatar answered Dec 04 '22 13:12

Alexander Pacha