1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

[Flutter] Flutter app Build failed with an exception of gradle minSdk

Discussão em 'Mobile' iniciado por Stack, Outubro 7, 2024 às 10:32.

  1. Stack

    Stack Membro Participativo

    I've working on a flutter app project specifically for android release but when launching app, suddenly came accross this error. I tried what's written in recommended solution but it's not working.

    The build tends to fail because of minSdk version being low.

    I recently added Firebase cli and Firebase configuration etc to add backend to my app and after doing all that it gave this error but It also occurred in my previous projects also where I didn't use firebase.

    When I paste the minsdk text in build.grade file, it shows error and nothing happens.

    Sorry if I didn't provide full information, as it is my first time writing a question on SO.

    I'm giving the full error(Debug Console) message here :-

    <project-path>Error:
    uses-sdk:minSdkVersion 21 cannot be smaller than version 23 declared in library [:firebase_auth] J:\flutter_projects\messaging_app\build\firebase_auth\intermediates\merged_manifest\debug\AndroidManifest.xml as the library might be using APIs not available in 21
    Suggestion: use a compatible library with a minSdk of at most 21,
    or increase this project's minSdk version to at least 23,
    or use tools:eek:verrideLibrary="io.flutter.plugins.firebase.auth" to force usage (may lead to runtime failures)

    FAILURE: Build failed with an exception.

    * What went wrong:
    Execution failed for task ':app:processDebugMainManifest'.
    > Manifest merger failed : uses-sdk:minSdkVersion 21 cannot be smaller than version 23 declared in library [:firebase_auth] J:\flutter_projects\messaging_app\build\firebase_auth\intermediates\merged_manifest\debug\AndroidManifest.xml as the library might be using APIs not available in 21
    Suggestion: use a compatible library with a minSdk of at most 21,
    or increase this project's minSdk version to at least 23,
    or use tools:eek:verrideLibrary="io.flutter.plugins.firebase.auth" to force usage (may lead to runtime failures)

    * 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 4s

    ┌─ Flutter Fix ─────────────────────────────────────────────────────────────────────────────────┐
    │ The plugin firebase_auth requires a higher Android SDK version. │
    │ Fix this issue by adding the following to the file │
    │ J:\flutter_projects\messaging_app\android\app\build.gradle: │
    │ android { │
    │ defaultConfig { │
    │ minSdkVersion 23 │
    │ } │
    │ } │
    │ │
    │ Following this change, your app will not be available to users running Android SDKs below 23. │
    │ Consider searching for a version of this plugin that supports these lower versions of the │
    │ Android SDK instead. │
    │ For more information, see: │
    │ https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration │
    └───────────────────────────────────────────────────────────────────────────────────────────────┘
    Error: Gradle task assembleDebug failed with exit code 1


    After pasteing the given/recommended code in error message into gradle.build it gave me error in the file and does not tend to solve anything. I've looked it on chatGpt but its solutions doesnt seem to work at all.

    Continue reading...

Compartilhe esta Página