在AndroidManifest.xml:16:5-39:19的<application>元素中添加'tools:replace =“ android:label”'以覆盖

时间:2019-02-28 11:06:39

标签: android flutter

我收到此错误

  

错误:来自以下位置的属性application @ label value =(flutter_bloc_pattern)   AndroidManifest.xml:18:9-45也位于   [:DynamsoftBarcodeReader] AndroidManifest.xml:13:9-41   值=(@ string / app_name)。

构建失败,并显示错误

 C:\Users\user\AndroidStudioProjects\Flutter Example\Flutter BLoC Pattern\android\app\src\main\AndroidManifest.xml:18:9-45 Error:
        Attribute application@label value=(flutter_bloc_pattern) from AndroidManifest.xml:18:9-45
        is also present at [:DynamsoftBarcodeReader] AndroidManifest.xml:13:9-41 value=(@string/app_name).
        Suggestion: add 'tools:replace="android:label"' to <application> element at AndroidManifest.xml:16:5-39:19 to override.

    FAILURE: Build failed with an exception.

    * What went wrong:
    Execution failed for task ':app:processDebugManifest'.
    > Manifest merger failed : Attribute application@label value=(flutter_bloc_pattern) from AndroidManifest.xml:18:9-45
        is also present at [:DynamsoftBarcodeReader] AndroidManifest.xml:13:9-41 value=(@string/app_name).
        Suggestion: add 'tools:replace="android:label"' to <application> element at AndroidManifest.xml:16:5-39:19 to override.

    * 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 FAILED in 3s
    Finished with error: Gradle task assembleDebug failed with exit code 1

我的清单就是这个

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="nz.co.plumbingworld.flutterblocpattern">

    <!-- The INTERNET permission is required for development. Specifically,
         flutter needs it to communicate with the running application
         to allow setting breakpoints, to provide hot reload, etc.
    -->
    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>

    <!-- io.flutter.app.FlutterApplication is an android.app.Application that
         calls FlutterMain.startInitialization(this); in its onCreate method.
         In most cases you can leave this as-is, but you if you want to provide
         additional functionality it is fine to subclass or reimplement
         FlutterApplication and put your custom class here. -->
    <application
        android:name="io.flutter.app.FlutterApplication"
        android:label="flutter_bloc_pattern"
        android:icon="@mipmap/ic_launcher">
        <activity
            android:name=".MainActivity"
            android:launchMode="singleTop"
            android:theme="@style/LaunchTheme"
            android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density"
            android:hardwareAccelerated="true"
            android:windowSoftInputMode="adjustResize">
            <!-- This keeps the window background of the activity showing
                 until Flutter renders its first frame. It can be removed if
                 there is no splash screen (such as the default splash screen
                 defined in @style/LaunchTheme). -->
            <meta-data
                android:name="io.flutter.app.android.SplashScreenUntilFirstFrame"
                android:value="true" />
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity>
    </application>
</manifest>

1 个答案:

答案 0 :(得分:1)

错误消息告诉您AndroidManifest.xmlandroid:label的{​​{1}}值已经存在于(库/插件/项目)flutter_bloc_pattern的清单中。

您可以按照错误提示将DynamsoftBarcodeReader添加到清单中的tools:replace="android:label"节点

<application>

如果添加<application tools:replace="android:label" android:name="io.flutter.app.FlutterApplication" android:label="flutter_bloc_pattern" android:icon="@mipmap/ic_launcher"> 属性,则还需要添加架构

tools