Faizan Kamal
Faizan Kamal

Reputation: 2172

Attribute application@name at AndroidManifest.xml:5:9-42 requires a placeholder substitution but no value for <applicationName> is provided. - Flutter

Upon running a project I'm getting following error.

Launching lib\main.dart on SM N970F in debug mode...
lib\main.dart:1
Parameter format not correct -
D:\CIIT GUIDE\Flutter\Apps\multi_delivery_app\android\app\src\main\AndroidManifest.xml:5:9-42 Error:
    Attribute application@name at AndroidManifest.xml:5:9-42 requires a placeholder substitution but no value for <applicationName> is provided.
D:\CIIT GUIDE\Flutter\Apps\multi_delivery_app\android\app\src\debug\AndroidManifest.xml Error:
    Validation failed, exiting

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processDebugMainManifest'.
> Manifest merger failed with multiple errors, see logs

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

This is how build.gradle looks like in android/app.


android {
    compileSdkVersion 29
    // buildToolsVersion '26.0.3'

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    kotlinOptions {
        jvmTarget = '1.8'
    }

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

    defaultConfig {
        applicationId "com.example.multi_delivery_app"
        minSdkVersion 28
        targetSdkVersion 29
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
        // Stackoverflow solution
        manifestPlaceholders = [appAuthRedirectScheme: "com.example.multi_delivery_app"]   
    }

    buildTypes {
        release {
            signingConfig signingConfigs.debug
        }
    }

I found a couple of solutions of it online, which are related to react-native but nothing is working. Following is the link of the solution that I tried. https://stackoverflow.com/a/52178888/7290043

Upvotes: 28

Views: 29771

Answers (6)

Zaman Rajpoot
Zaman Rajpoot

Reputation: 523

just add this line in your app-level build.gradle

buildTypes {
        debug{
            manifestPlaceholders = [consumerAppId:"com.rsp.liftprojectsipclient"]
...
        }
        release {
            manifestPlaceholders = [consumerAppId:"com.rsp.liftprojectsipclient"]
...
    }

Upvotes: 1

Mustafa Max
Mustafa Max

Reputation: 69

I have faced such a problem.
I discovered that the package was not defined in the manifest file.
As shown in the picture
enter image description here

Upvotes: 0

Bhatti Shb
Bhatti Shb

Reputation: 31

in AndroidManifest.xml

 android:name="${applicationName}" // change application to applicationName
 android:label="olt"
 android:icon="@mipmap/launcher_icon">```

Upvotes: 0

Equaldog
Equaldog

Reputation: 581

You can add the appAuthRedirectScheme attributes to the manifestPlaceholders instead of replacing the whole array, by using += instead of =

Example :

defaultConfig {
    ...
    manifestPlaceholders += [appAuthRedirectScheme: "com.example.multi_delivery_app"]
}

Upvotes: 58

Ary Anzh
Ary Anzh

Reputation: 474

add this code in your AndroidManifest.xml file, located in android\app\src\main\AndroidManifest.xml

android:name="${applicationName}"

Example:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.your_app_name">

   <application
        android:label="Your App Name"
        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">
            
            <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>
        <meta-data
            android:name="flutterEmbedding"
            android:value="2" />
    </application>
</manifest>

Upvotes: 1

plplmax
plplmax

Reputation: 2775

I think in build.gradle should add the applicationName key with the full name of the Android Application class (which extends the FlutterApplication)

For example:

defaultConfig {
    ...
    manifestPlaceholders = [appAuthRedirectScheme: "com.example.multi_delivery_app", 
                            applicationName: "com.example.multi_delivery_app.Application"]
}

Upvotes: 17

Related Questions