I can't fix my problem with an error: 'mainMergedManifest' does not exist

I recently installed the android.studio and the fluttter app, and everything went good with the instalation.But i always encounter this problem when I try to run my code.

  • What went wrong:
    A problem was found with the configuration of task ‘:app:processDebugManifest’ (type ‘ProcessMultiApkApplicationManifest’).

File ‘F:\Flutter project\first_app\build\app\intermediates\merged_manifest\debug\out\AndroidManifest.xml’ specified for property ‘mainMergedManifest’ does not exist.

  1. This is my build.gradle\app file
    def localProperties = new Properties()
    def localPropertiesFile = rootProject.file(‘local.properties’)
    if (localPropertiesFile.exists()) {
    localPropertiesFile.withReader(‘UTF-8’) { reader →
    localProperties.load(reader)
    }
    }

def flutterRoot = localProperties.getProperty(‘flutter.sdk’)
if (flutterRoot == null) {
throw new GradleException(“Flutter SDK not found. Define location with flutter.sdk in the local.properties file.”)
}

def flutterVersionCode = localProperties.getProperty(‘flutter.versionCode’)
if (flutterVersionCode == null) {
flutterVersionCode = ‘1’
}

def flutterVersionName = localProperties.getProperty(‘flutter.versionName’)
if (flutterVersionName == null) {
flutterVersionName = ‘1.0’
}

apply plugin: ‘com.android.application’
apply plugin: ‘kotlin-android’
apply from: “$flutterRoot/packages/flutter_tools/gradle/flutter.gradle”

android {
compileSdkVersion flutter.compileSdkVersion

compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}

kotlinOptions {
    jvmTarget = '1.8'
}

sourceSets {
    main.java.srcDirs += 'src/main/kotlin'
}

defaultConfig {
    // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
    applicationId "com.example.first_app"
    minSdkVersion flutter.minSdkVersion
    targetSdkVersion flutter.targetSdkVersion
    versionCode flutterVersionCode.toInteger()
    versionName flutterVersionName
}

buildTypes {
    release {
        // TODO: Add your own signing config for the release build.
        // Signing with the debug keys for now, so `flutter run --release` works.
        signingConfig signingConfigs.debug
    }
}

}

flutter {
source ‘…/…’
}

dependencies {
implementation “org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version”
}
2. This is my build.gradle\android file
buildscript {

ext.kotlin_version = '1.6.10'

repositories {

    google()

    mavenCentral()

}

dependencies {

    classpath 'com.android.tools.build:gradle:4.1.0'

    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

}

}

allprojects {

repositories {

    google()

    mavenCentral()

}

}

rootProject.buildDir = ‘…/build’

subprojects {

project.buildDir = "${rootProject.buildDir}/${project.name}"

}

subprojects {

project.evaluationDependsOn(':app')

}

task clean(type: Delete) {

delete rootProject.buildDir

}
3. Android Manifest.xml Debug




4. Android Manifest.xml Main
<manifest xmlns:android=“http://schemas.android.com/apk/res/android

package="com.example.first_app">

<application

    android:label="first_app"

    android:name="${applicationName}"

    android:icon="@mipmap/ic_launcher">

    <activity

        android:name=".MainActivity"

        android:exported="true"

        android:launchMode="singleTop"

        android:theme="@style/LaunchTheme"

        android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"

        android:hardwareAccelerated="true"

        android:windowSoftInputMode="adjustResize">

        <!-- Specifies an Android theme to apply to this Activity as soon as

             the Android process has started. This theme is visible to the user

             while the Flutter UI initializes. After that, this theme continues

             to determine the Window background behind the Flutter UI. -->

        <meta-data

          android:name="io.flutter.embedding.android.NormalTheme"

          android:resource="@style/NormalTheme"

          />

        <intent-filter>

            <action android:name="android.intent.action.MAIN"/>

            <category android:name="android.intent.category.LAUNCHER"/>

        </intent-filter>

    </activity>

    <!-- Don't delete the meta-data below.

         This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->

    <meta-data

        android:name="flutterEmbedding"

        android:value="2" />

</application>

yea same here, my app builds on Chrome and other web browsers but whenever I run it to use my Android phone (which I downloaded with Android Studio’s AVD Manager) it always gives me this exact same error. I’m running the app on Windows btw.