首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >属性application@name at AndroidManifest.xml:5:9-42需要一个占位符替换,但没有为<applicationName>提供任何值。-颤振

属性application@name at AndroidManifest.xml:5:9-42需要一个占位符替换,但没有为<applicationName>提供任何值。-颤振
EN

Stack Overflow用户
提问于 2022-01-29 15:22:21
回答 5查看 9.6K关注 0票数 10

在运行一个项目时,我会得到以下错误。

代码语言:javascript
运行
复制
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

这就是build.gradleandroid/app中的样子。

代码语言:javascript
运行
复制
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
        }
    }

我在网上找到了几个解决方案,这些解决方案都是与反应相关的--本土的,但没有效果。下面是我尝试过的解决方案的链接。https://stackoverflow.com/a/52178888/7290043

EN

回答 5

Stack Overflow用户

回答已采纳

发布于 2022-01-29 15:53:09

我认为在build.gradle中应该添加带有Application类全名的applicationName键(它扩展了FlutterApplication)

例如:

代码语言:javascript
运行
复制
defaultConfig {
    ...
    manifestPlaceholders = [appAuthRedirectScheme: "com.example.multi_delivery_app", 
                            applicationName: "com.example.multi_delivery_app.Application"]
}
票数 13
EN

Stack Overflow用户

发布于 2022-02-24 09:47:54

您可以将appAuthRedirectScheme属性添加到manifestPlaceholders,而不是替换整个数组,方法是使用+=而不是=

例子:

代码语言:javascript
运行
复制
defaultConfig {
    ...
    manifestPlaceholders += [appAuthRedirectScheme: "com.example.multi_delivery_app"]
}
票数 18
EN

Stack Overflow用户

发布于 2022-01-29 15:53:36

将此代码添加到位于AndroidManifest.xml文件中的android\app\src\main\AndroidManifest.xml文件中

android:name="${applicationName}"

示例:

代码语言:javascript
运行
复制
<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>
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/70906879

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档