在flutter 2.8中更新minsdkversion后出错

9jyewag0  于 2023-03-13  发布在  Flutter
关注(0)|答案(2)|浏览(146)

我是一个初学者在flutter。我已经更新minSdkVersion从19到21和得到以下错误。请帮助。任何形式的帮助是非常感谢。谢谢你提前。

Manifest merger failed : Attribute application@label value=(Car_Wash_App) from AndroidManifest.xml:11:9-37
is also present at [org.jfrog.cardinalcommerce.gradle:cardinalmobilesdk:2.2.4-1] AndroidManifest.xml:15:9-41 value=(@string/app_name).
Suggestion: add 'tools:replace="android:label"' to <application> element at AndroidManifest.xml:9:5-48:19 to override.

这是清单文件

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.Car_Wash_App">
<!-- 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="Car_Wash_App"
    android:icon="@mipmap/ic_launcher"
    tools:replace="android:label">
    <activity
        android:name=".MainActivity"
        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">
        <!-- Specifies an Android theme to apply to this Activity as soon as
             the Android process has started. This theme is visible to the user
             while the Flutter UI initializes. After that, this theme continues
             to determine the Window background behind the Flutter UI. -->
        <meta-data
          android:name="io.flutter.embedding.android.NormalTheme"
          android:resource="@style/NormalTheme"
          />
        <!-- Displays an Android View that continues showing the launch screen
             Drawable until Flutter paints its first frame, then this splash
             screen fades out. A splash screen is useful to avoid any visual
             gap between the end of Android's launch screen and the painting of
             Flutter's first frame. -->
        <meta-data
          android:name="io.flutter.embedding.android.SplashScreenDrawable"
          android:resource="@drawable/launch_background"
          />
        <intent-filter>
            <action android:name="android.intent.action.MAIN"/>
            <category android:name="android.intent.category.LAUNCHER"/>
        </intent-filter>
    </activity>

    <!-- Don't delete the meta-data below.
         This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
    <meta-data
        android:name="flutterEmbedding"
        android:value="2" />
</application>
7fyelxc5

7fyelxc51#

你得把它们都加起来。区别是:

  • xmlns:工具=”http://schemas.android.com/tools“
  • 工具:替换=“安卓系统:标签”

你必须改变你的android清单文件如下。

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example">

    <application
        android:allowBackup="true"
        android:label="@string/app_name"
        android:supportsRtl="true">
       </application>
</manifest>

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.name"
    xmlns:tools="http://schemas.android.com/tools">

    <application
        android:allowBackup="true"
        android:label="App Name"
        android:supportsRtl="true"
        tools:replace="android:label">
        </application>
</manifest>

现在android:标签被来自父应用程序的标签所取代。

aiazj4mn

aiazj4mn2#

伙计,你只需要将你的项目迁移到androidX

open android directory of your project in android studio
wait for gradle to finish its task
then go to tools -> migrate to androidX
click migrate
click do refactor

或者,您也可以按照答案https://stackoverflow.com/a/54857699/16793736中的步骤操作

相关问题