Android studio 3: Could not find the AndroidManifest.xml file

Viewed 7757

after migrating to Android studio 3 I'm unable to compile as I' have folowing errors:

Error:Could not find the AndroidManifest.xml file, using  generation 
folder 
[/home/salacr/git/Evotech/app/build/generated/source/apt/debug])
Error:Parceler: Code generation did not complete successfully.  For 
more details add the compiler argument -AparcelerStacktrace
Error:Execution failed for task ':app:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

It might be connected with usage of android anotation my app/build.gradle looks like this:

apply plugin: 'com.android.application'
apply plugin: 'realm-android'

def AAVersion = '4.3.1'
def parcelerVersion = '1.1.9'

android {
    compileSdkVersion 26
    buildToolsVersion '26.0.1'

    defaultConfig {
        applicationId "com.my.app"
        minSdkVersion 16
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
    }
    signingConfigs {
        release {
            storeFile file("******")
            storePassword "******"
            keyAlias "******"
            keyPassword "******"
        }
    }
    buildTypes {
        release {
            minifyEnabled false
            signingConfig signingConfigs.release
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    packagingOptions {
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
    }

    splits {
        abi {
            enable true // enable ABI split feature to create one APK per ABI
            universalApk true //generate an additional APK that targets all the ABIs
        }
    }
    /*
    // map for the version code
    project.ext.versionCodes = ['armeabi':1, 'armeabi-v7a':2, 'arm64-v8a':3, 'mips':5, 'mips64':6, 'x86':8, 'x86_64':9]

    android.applicationVariants.all { variant ->
        // assign different version code for each output
        variant.outputs.each { output ->
            output.versionCodeOverride =
                    project.ext.versionCodes.get(output.getFilter(com.android.build.OutputFile.ABI), 0) * 1000000 + android.defaultConfig.versionCode
        }
    }
    */

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

}

dependencies {

    implementation "org.parceler:parceler-api:$parcelerVersion"
    annotationProcessor "org.parceler:parceler:$parcelerVersion"
    annotationProcessor "org.androidannotations:androidannotations:$AAVersion"
    implementation "org.androidannotations:androidannotations-api:$AAVersion"
    implementation 'com.android.support:appcompat-v7:26.0.1'
    implementation 'com.android.support:multidex:1.0.2'
}

I'm unable to find the root cause for this, any suggestions? I tried diferent graddle versions as well as using different buildToolsVersion tools, but without effect.

Any suggestions?

Thanks!

EDIT 1: I have found out that problem is here:

splits {
    abi {
        enable true // enable ABI split feature to create one APK per ABI
        universalApk true //generate an additional APK that targets all the ABIs
    }
}

Without this everything works as expected. IT seams that this config isn't compatible with androidanotations in new Android studio

EDIT 2: There is already issue in androidanotation: https://github.com/androidannotations/androidannotations/issues/2034

4 Answers

I had similar issue and solved my problem when I updated android annotation version from 4.4.0 to 4.5.0.

Add the following code in build.gradle file under defaultConfig

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

I solved this problem changed graddle version:

dependencies {
    classpath 'com.android.tools.build:gradle:3.1.4'

I had similar issue and solved my problem when I updated android annotation version from 4.4.0 to 4.6.0.

Related