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

问题描述 投票:0回答:1

我收到了这个错误

错误:来自AndroidManifest.xml的属性应用程序@ label value =(flutter_bloc_pattern):18:9-45也出现在[:DynamsoftBarcodeReader] AndroidManifest.xml:13:9-41 value =(@ 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>
android flutter
1个回答
2
投票

错误信息告诉你,在你AndroidManifest.xml你的android:labelflutter_bloc_pattern已经存在于(library / plugin / project)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属性,还需要添加模式

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="nz.co.plumbingworld.flutterblocpattern">
© www.soinside.com 2019 - 2024. All rights reserved.