Android "mainMergedManifest" does not exist

Viewed 9818

I am having a build issue with the following error code:

A problem was found with the configuration of task ':app:processDebugManifest' (type 'ProcessMultiApkApplicationManifest').

File 'E:\DK\app\build\intermediates\merged_manifest\debug\out\AndroidManifest.xml' specified for property 'mainMergedManifest' does not exist.

build.gradle

apply plugin: 'com.android.application'
android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
defaultConfig {
    applicationId "com.example.sample"
    minSdkVersion 21
    targetSdkVersion 29
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
    }
}

compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}
}

dependencies {
// Import the BoM for the Firebase platform
implementation platform('com.google.firebase:firebase-bom:26.1.0')

// Declare the dependency for the Firebase Authentication library
// When using the BoM, you don't specify versions in Firebase library dependencies
implementation 'com.google.firebase:firebase-auth'

implementation 'com.google.android.material:material:1.2.1'

implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'com.google.firebase:firebase-auth:16.0.5'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
implementation 'com.google.firebase:firebase-database:19.5.1'
implementation 'com.google.firebase:firebase-storage:19.2.0'
implementation 'com.github.bumptech.glide:glide:4.11.0'
implementation 'com.google.gms:google-services:4.3.4'
    implementation 'androidx.browser:browser:1.2.0'
}
apply plugin: 'com.google.gms.google-services'

AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.sample">
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

<application
    android:allowBackup="true"
    android:icon="@drawable/logo"
    android:label="@string/app_name"

    android:roundIcon="@mipmap/ic_launcher_round"
    android:supportsRtl="true"
    android:theme="@style/AppTheme">
    <activity
        android:name=".Activities.SplashActivity"
        android:theme="@style/AppTheme.Launcher"
        android:windowSoftInputMode="adjustPan"
        android:screenOrientation="portrait"
        android:configChanges="orientation">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <action android:name="android.intent.action.VIEW" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity android:name=".Activities.LoginActivity"
        android:screenOrientation="portrait"
        android:configChanges="orientation"/>
    <activity android:name=".Activities.MainActivity"
        android:windowSoftInputMode="adjustPan"
        android:screenOrientation="portrait"
        android:configChanges="orientation"/>
    <activity android:name=".Activities.SignUpActivity"
        android:screenOrientation="portrait"
        android:configChanges="orientation"/>
    <activity android:name=".Activities.DebugActivity"
        android:screenOrientation="portrait"
        android:configChanges="orientation"/>
</application>

I am new to this and I can't seem to figure out what the issue may be. We are working on an application together and noone seems to know the issue. We are beginners, with little to no experience.

3 Answers

In your build.gradle, you have these 2 lines:

compileSdkVersion 29

and

targetSdkVersion 29

The error you have shown occurs when that sdk version is not installed or does not match that of the API version on the virtual device (assuming you are using the emulator).

There are 2 things to check:

In Tools->SDK Manager, check what SDK version is installed. Your project is compiling for SDK version 29, so if you don't have 29 installed and want to use that, install it. Or if you have version 30 installed, simply change those 2 lines in your build.gradle from "29" to "30".

In Tools->AVD Manager, check the API level of your virtual device. Does it match? If not, create a new device that matches, or just simply install the matching API or change the 2 lines of code as described above.

Also, for this line:

minSdkVersion 21

Make sure SDK version 21 is installed too.

I was getting same error : "app\build\intermediates\merged_manifest\debug\out\AndroidManifest.xml' specified for property 'mainMergedManifest' does not exist."

Solution:

  1. Update Project Structure

Update in the Project Structure->Module->Properties

  • Compile SDK Version= 30 (API 30 Android 11.0(R))
  • Build tools verision= 30 .0.2

Update in the Project Structure->Module->Default Config

  • Target SDK Version = 30 (API 30 Android 11.0(R))
  1. Update 2 files as the next:

file: build.gradle classpath "com.android.tools.build:gradle:4.0.2"

file: gradle-wrapper.properties

Line: distributionUrl=https://services.gradle.org/distributions/gradle-6.4.1-bin.zip

here are the video with the solution Step 2

https://www.youtube.com/watch?v=U420dx6C60I

SPANISH: ¿Problema con React Native? Resolví el error moviendo el proyecto al disco C: y además usar el mismo SDK que recomiendan en la documentación de React Native.

ENGLISH: From React Native? I solved this, moving my project to local disk C:, make sure you have the same SDK that de documentation recommends.

Related