AndroidManifest.xml:5:9-42 中的属性 application@name 需要占位符替换,但未提供 <applicationName> 的值。- 颤振

Fai*_*mal 21 android android-manifest dart flutter

运行项目后,我收到以下错误。

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

Run Code Online (Sandbox Code Playgroud)

这就是build.gradle中的样子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
        }
    }
Run Code Online (Sandbox Code Playgroud)

我在网上找到了几个与react-native相关的解决方案,但没有任何效果。以下是我尝试过的解决方案的链接。 /sf/answers/3652522191/

小智 44

您可以通过使用而不是替换整个数组来添加appAuthRedirectScheme属性manifestPlaceholders+==

例子 :

defaultConfig {
    ...
    manifestPlaceholders += [appAuthRedirectScheme: "com.example.multi_delivery_app"]
}
Run Code Online (Sandbox Code Playgroud)

  • 就是这样 (2认同)

plp*_*max 16

我认为build.gradle应该添加applicationName带有Android应用程序类的全名的键(它扩展了FlutterApplication

例如:

defaultConfig {
    ...
    manifestPlaceholders = [appAuthRedirectScheme: "com.example.multi_delivery_app", 
                            applicationName: "com.example.multi_delivery_app.Application"]
}
Run Code Online (Sandbox Code Playgroud)