Home > Software engineering >  error after updating minsdkversion in flutter 2.8
error after updating minsdkversion in flutter 2.8

Time:12-25

I am a beginner in flutter. I have update minSdkVersion from 19 to 21 and getting the following error. Please Please help. any kind of help is much appreciated. Thank you in advance.

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.

here is the manifest file

<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>

CodePudding user response:

Buddy you just need to migrate your project to 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

or you can simply follow steps from following answer https://stackoverflow.com/a/54857699/16793736

CodePudding user response:

You have to change your android manifest file like below

<?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>

To

<?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>

And now the android:label is replaced by the label from the parent application.

  • Related