[SOLVED] Flutter Unresolved class ‘ApplicationName’

Issue

This Content is from Stack Overflow. Question asked by Abdullah T

I wanted to upload my application to git, it gives a warning and when I say show the warning, I get an error like this. I just opened the android folder and synced, but I could not get a result. This issue only occurs when trying to upload my project to git. I tried many ways but failed
How can I fix this problem?

    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="com.example.apmatik"
    tools:ignore="MissingVersion">
   <application
        android:label="apmatik"
        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="flutterEmbedding"
                android:value="2"
                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>
</manifest>

Solution

Setting manifestPlaceholders manually in our app/build.gradle:

android {
⋮
defaultConfig {
   ⋮
    // Add This line
    manifestPlaceholders = [applicationName: "android.app.Application"]
   }
   ⋮
 }

Solution 2 : Add this code in app/build.gradle :

    buildTypes {
    release {
        manifestPlaceholders = [applicationName: "android.app.Application"]
    }

    debug {
        manifestPlaceholders = [applicationName: "android.app.Application"]
    }
    build{
        manifestPlaceholders = [applicationName: "android.app.Application"]
    }
  }

Answered by u0j
This Question and Answer are collected from stackoverflow and tested by JTuto community, is licensed under the terms of CC BY-SA 4.0.

people found this article helpful. What about you?