Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

like image 831
ebolax Avatar asked Aug 14 '17 20:08

ebolax


People also ask

Where is the AndroidManifest xml file in Android Studio?

Every project in Android includes a Manifest XML file, which is AndroidManifest. xml, located in the root directory of its project hierarchy. The manifest file is an important part of our app because it defines the structure and metadata of our application, its components, and its requirements.

What is AndroidManifest xml in Android Studio?

Every app project must have an AndroidManifest. xml file (with precisely that name) at the root of the project source set. The manifest file describes essential information about your app to the Android build tools, the Android operating system, and Google Play.

How do I change AndroidManifest xml?

Open your Android project and go to <AppProjectFolder>/app/src/main/. Open the app manifest file AndroidManifest. xml and add the following lines to the file as child elements of the <manifest> element. Note: You must include the QUERY_ALL_PACKAGES permission if your app targets Android 11 (API Level 30) or higher.

Where is the AndroidManifest xml file flutter?

Android app manifest file, AndroidManifest. xml is located in <app dir>/android/app/src/main. It contains entire details about an android application.


2 Answers

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

like image 69
MeLean Avatar answered Sep 28 '22 02:09

MeLean


Add the following code in build.gradle file under defaultConfig

   javaCompileOptions {
        annotationProcessorOptions {
            arguments = [
                    "androidManifestFile":"$projectDir/src/main/AndroidManifest.xml".toString()
            ]
        }
    }
like image 39
Aakriti Sayal Avatar answered Sep 28 '22 01:09

Aakriti Sayal