fluttercommunity / plus_plugins

Flutter Community Plus Plugins
BSD 3-Clause "New" or "Revised" License
1.62k stars 975 forks source link

[Compile]: FAILED TO RUN AFTER UPDATING TO ANDROID STUDIO LADY BUG *** CRITICAL #3299

Closed mehrdad1990 closed 1 month ago

mehrdad1990 commented 1 month ago

Operating System

Windows 11

Plugin

connectivity_plus

Version

6.0.5

Flutter SDK

Flutter 3.24.3 • channel stable • https://github.com/flutter/flutter.git Framework • revision 2663184aa7 (3 weeks ago) • 2024-09-11 16:27:48 -0500 Engine • revision 36335019a8 Tools • Dart 3.5.3 • DevTools 2.37.3

Compilation command

running the project normally in Android Studio: flutter run flutter debug

Dart Dependencies

No response

Native dependencies

No response

Compilation Error

* What went wrong:
Execution failed for task ':connectivity_plus:compileDebugJavaWithJavac'.
> Could not resolve all files for configuration ':connectivity_plus:androidJdkImage'.
   > Failed to transform core-for-system-modules.jar to match attributes {artifactType=_internal_android_jdk_image, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}.
      > Execution failed for JdkImageTransform: D:\SDK\platforms\android-34\core-for-system-modules.jar.
         > Error while executing process C:\Program Files\Android\Android Studio\jbr\bin\jlink.exe with arguments {--module-path C:\Users\ASUS\.gradle\caches\transforms-4\27d4116a6b8bfadbced0f80b87c44b18-3637e9fd-df62-40a9-93a2-142d7473c4e3\transformed\output\temp\jmod --add-modules java.base --output C:\Users\ASUS\.gradle\caches\transforms-4\27d4116a6b8bfadbced0f80b87c44b18-3637e9fd-df62-40a9-93a2-142d7473c4e3\transformed\output\jdkImage --disable-plugin system-modules}

Flutter Doctor

[√] Flutter (Channel stable, 3.24.3, on Microsoft Windows [Version 10.0.22631.4249], locale en-US)
    • Flutter version 3.24.3 on channel stable at D:\SDK\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 2663184aa7 (3 weeks ago), 2024-09-11 16:27:48 -0500
    • Engine revision 36335019a8
    • Dart version 3.5.3
    • DevTools version 2.37.3

[√] Windows Version (Installed version of Windows is version 10 or higher)

[√] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
    • Android SDK at D:\SDK
    • Platform android-35, build-tools 35.0.0
    • Java binary at: C:\Program Files\Android\Android Studio\jbr\bin\java
    • Java version OpenJDK Runtime Environment (build 21.0.3+-12282718-b509.11)
    • All Android licenses accepted.

[√] Chrome - develop for the web
    • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.11.3)
    • Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
    • Visual Studio Community 2022 version 17.11.35303.130
    • Windows 10 SDK version 10.0.22621.0

[√] Android Studio (version 2024.2)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 21.0.3+-12282718-b509.11)

[√] Connected device (4 available)
    • sdk gphone64 x86 64 (mobile) • emulator-5554 • android-x64    • Android 15 (API 35) (emulator)
    • Windows (desktop)            • windows       • windows-x64    • Microsoft Windows [Version 10.0.22631.4249]
    • Chrome (web)                 • chrome        • web-javascript • Google Chrome 129.0.6668.90
    • Edge (web)                   • edge          • web-javascript • Microsoft Edge 129.0.2792.65

[√] Network resources
    • All expected network resources are available.

• No issues found!
Process finished with exit code 0

Checklist before submitting a bug

AmrTawfek commented 1 month ago

same issue

mehrdad1990 commented 1 month ago

same issue @AmrTawfek try this version in settings.gradle. Seems to sort out the issue for now: id "com.android.application" version "8.3.2" apply false

AmrTawfek commented 1 month ago

same issue @AmrTawfek try this version in settings.gradle. Seems to sort out the issue for now: id "com.android.application" version "8.3.2" apply false

thanks @mehrdad1990 , I will try it because when I countered this issue I downgraded my IDE version to latest working one

adham-ashraf77 commented 1 month ago

what is the Gradle version you use please in distributionUrl? @mehrdad1990

daksh-gargas commented 1 month ago

Getting same issue on MacOS.

Downgrading the AndroidStudio did not fix the issue

* What went wrong:
Execution failed for task ':device_info_plus:compileReleaseJavaWithJavac'.
> Could not resolve all files for configuration ':device_info_plus:androidJdkImage'.
   > Failed to transform core-for-system-modules.jar to match attributes {artifactType=_internal_android_jdk_image, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}.
      > Execution failed for JdkImageTransform: /Users/daksh-gargas/dev/Android/sdk/platforms/android-34/core-for-system-modules.jar.
         > Error while executing process /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/jlink with arguments {--module-path /Users/daksh-gargas/.gradle/caches/transforms-3/e8dfe22a750ee0e24ac6b098f580808c/transformed/output/temp/jmod --add-modules java.base --output /Users/daksh-gargas/.gradle/caches/transforms-3/e8dfe22a750ee0e24ac6b098f580808c/transformed/output/jdkImage --disable-plugin system-modules}

* 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.
7AveNooN7 commented 1 month ago
* What went wrong:
Execution failed for task ':connectivity_plus:compileDebugJavaWithJavac'.
> Could not resolve all files for configuration ':connectivity_plus:androidJdkImage'.

Same problem, but I resolved it with updating AGP version (from 7.3.0): id "com.android.application" version "8.3.0" apply false

Unfortunately updating to a newer AGP requires some additional tweaks.

mehrdad1990 commented 1 month ago

what is the Gradle version you use please in distributionUrl? @mehrdad1990

@adham-ashraf77 this is the version : gradle-8.6-all

navin2580 commented 1 month ago

same for me. I am unable to use workaround with updating AGP version because it affects other packages :(

Nico04 commented 1 month ago

same for me. I am unable to use workaround with updating AGP version because it affects other packages :(

We have a huge app that use a lot of dependencies, I migrated AGP and all affected packages, I had to fork some myself unfortunately. But know it works.

navin2580 commented 1 month ago

same for me. I am unable to use workaround with updating AGP version because it affects other packages :(

We have a huge app that use a lot of dependencies, I migrated AGP and all affected packages, I had to fork some myself unfortunately. But know it works.

Yep, that's the way, but I don't want to fork other packages if there's a chance of a possible fix

iBog commented 1 month ago

seems working with latest

id "com.android.application" version "8.7.0" apply false

TheHasnatBD commented 1 month ago

the same issue, all tricks failed

Supertommino commented 1 month ago

This worked for me:

id "com.android.application" version "8.7.0" apply false

mohmmadali155 commented 1 month ago

same issue

ujwal-yadav-aot commented 1 month ago

Could not resolve all files for configuration ':connectivity_plus:androidJdkImage'.

Failed to transform core-for-system-modules.jar to match attributes {artifactType=_internal_android_jdk_image, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}. Execution failed for JdkImageTransform: /Users/algooceansmacbook/Library/Android/sdk/platforms/android-34/core-for-system-modules.jar. Error while executing process /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/jlink with arguments {--module-path /Users/algooceansmacbook/.gradle/caches/transforms-3/b7ad379871a160c29269eed9ca2ef736/transformed/output/temp/jmod --add-modules java.base --output /Users/algooceansmacbook/.gradle/caches/transforms-3/b7ad379871a160c29269eed9ca2ef736/transformed/output/jdkImage --disable-plugin system-modules}

same issue

malwinder-s commented 1 month ago

Fixed issue by using:

id "com.android.application" version "8.7.0" apply false in plugins block In android/settings.gradle

Also set in gradle-wrapper.properties:

distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-all.zip Currently using Java version: java version "1.8.0_301"

ujwal-yadav-aot commented 1 month ago

Fixed issue by using:

id "com.android.application" version "8.7.0" apply false in plugins block In android/settings.gradle

yes this work for me additionally need to set distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-all.zip

Kuhlemann commented 1 month ago

Which Java/JDK-Version are you using in your projects for those solutions?

miquelbeltran commented 1 month ago

Thanks to everyone for helping each other fix the compilation issue. I am marking this issue as completed, but I pinned it so it is easier to find.

Please do as said by malwinder-s:

Fixed issue by using:

id "com.android.application" version "8.7.0" apply false in plugins block In android/settings.gradle

Also set in gradle-wrapper.properties:

distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-all.zip

Kuhlemann commented 1 month ago

Please do as said by malwinder-s:

Fixed issue by using: id "com.android.application" version "8.7.0" apply false in plugins block In android/settings.gradle Also set in gradle-wrapper.properties: distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-all.zip

When doing so, I get the error:

Your project is configured with Android NDK 23.1.7779620, but the following plugin(s) depend on a different Android NDK version:

  • connectivity_plus requires Android NDK 27.0.12077973
  • ....

My android parameters inside my build.gradle look like this:

android {
    namespace "my_app"
    compileSdkVersion flutter.compileSdkVersion
    ndkVersion flutter.ndkVersion

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_17
        targetCompatibility JavaVersion.VERSION_17
    }

    kotlinOptions {
        jvmTarget = '17'
    }

    sourceSets {
        main.java.srcDirs += 'src/main/kotlin'
    }

    defaultConfig {
        applicationId "my_app"
        minSdkVersion 23
        targetSdkVersion flutter.targetSdkVersion
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
    }

    buildTypes {
        release {
            signingConfig signingConfigs.debug
        }
    }
}

I use Android Studio Ladybug 2024.2.1. Before, with Koala and lower Gradle-version, everything worked fine.

miquelbeltran commented 1 month ago

Do you need to specify the ndkVersion? We don't set that in any plugin project or any example project

takeodev commented 1 month ago

I had the same issue, in "gradle-wrapper.properties" raised the version to: distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-all.zip

and in the "app/build.gradle" put: plugins { id "dev.flutter.flutter-plugin-loader" version "1.0.0" id "com.android.application" version "8.3.2" apply false id "org.jetbrains.kotlin.android" version "1.8.22" apply false }

But now i have another problem, my Release APK doenst have icon anymore and crash on installing... anyone know what is it? This is my "flutter doctor --verbose": ` [√] Flutter (Channel stable, 3.24.3, on Microsoft Windows [versÆo 10.0.22631.4169], locale pt-BR) • Flutter version 3.24.3 on channel stable at c:\src\flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision 2663184aa7 (3 weeks ago), 2024-09-11 16:27:48 -0500 • Engine revision 36335019a8 • Dart version 3.5.3 • DevTools version 2.37.3

[√] Windows Version (Installed version of Windows is version 10 or higher)

[√] Android toolchain - develop for Android devices (Android SDK version 35.0.0) • Android SDK at C:\Users\Takeo\AppData\Local\Android\sdk • Platform android-35, build-tools 35.0.0 • Java binary at: C:\Program Files\Android\Android Studio\jbr\bin\java • Java version OpenJDK Runtime Environment (build 21.0.3+-12282718-b509.11) • All Android licenses accepted.

[√] Chrome - develop for the web • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.7.4) • Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community • Visual Studio Community 2022 version 17.7.34031.279 • Windows 10 SDK version 10.0.22621.0

[√] Android Studio (version 2024.2) • Android Studio at C:\Program Files\Android\Android Studio • Flutter plugin can be installed from: https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 21.0.3+-12282718-b509.11)

[√] VS Code (version 1.94.0) • VS Code at C:\Users\Takeo\AppData\Local\Programs\Microsoft VS Code • Flutter extension version 3.98.0

[√] Connected device (4 available) • Android SDK built for x86 (mobile) • emulator-5554 • android-x86 • Android 7.1.1 (API 25) (emulator) • Windows (desktop) • windows • windows-x64 • Microsoft Windows [versÆo 10.0.22631.4169] • Chrome (web) • chrome • web-javascript • Google Chrome 127.0.6533.122 • Edge (web) • edge • web-javascript • Microsoft Edge 129.0.2792.65

[√] Network resources • All expected network resources are available.

• No issues found!`

Dont have errors on building apk.

Kuhlemann commented 1 month ago

Do you need to specify the ndkVersion? We don't set that in any plugin project or any example project

flutter create -a creates this specification automatically, but I deleted the line now.

By doing so I got a step further, but my build stills fails:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':kiosk_mode:compileDebugKotlin'.
> Inconsistent JVM-target compatibility detected for tasks 'compileDebugJavaWithJavac' (1.8) and 'compileDebugKotlin' (21).

But this problem seems to be related to pub.dev package "kiosk_mode" not being compatible with newer JDK/Gradle-versions, if I understand the error correctly.

miquelbeltran commented 1 month ago

Created a pinned issue with some more details on how to fix the recent Android compilation issues https://github.com/fluttercommunity/plus_plugins/issues/3303

arifxpartbd commented 1 month ago

Same issue how to fix

include ":app"

apply from: "${settings.ext.flutterSdkPath}/packages/flutter_tools/gradle/app_plugin_loader.gradle"

distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists

ottomancoder commented 1 month ago

Solution for Android Studio LadyBug Upgrade Issues

If you've encountered issues after upgrading to Android Studio LadyBug, here's how you can resolve them:

  1. Modify settings.gradle File:

    • Under the plugins section in your settings.gradle file, add the following line:
      id "com.android.application" version "8.3.2" apply false
  2. Gradle Plugin Error:

    • If you encounter any errors related to the Gradle plugin version, update your gradle-wrapper.properties file with the following:
      distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-all.zip

After making these changes, clean and rebuild your project to ensure everything compiles correctly.

raad9114 commented 1 month ago

FAILURE: Build failed with an exception.

BUILD FAILED in 8s Error: Gradle task assembleDebug failed with exit code 1

adham-ashraf77 commented 1 month ago

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ':app:checkDebugAarMetadata'.

A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction An issue was found when checking AAR metadata:

   1.  Dependency ':flutter_local_notifications' requires core library desugaring to be enabled
       for :app.

       See https://developer.android.com/studio/write/java8-support.html for more
       details.
  • 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 8s Error: Gradle task assembleDebug failed with exit code 1

Screenshot 2024-10-07 at 1 30 41 PM

add this found in docs

chiragthummar commented 1 month ago

If you dont want to go for this solution what I have applied is added specific JDK version using gradle.properties. org.gradle.java.home=<Your java version path>.

I have set JDK 11 for my project which was running good on Android Studio Koala.

wxkly8888 commented 1 month ago

It doesn't work for me for this workaround: id "com.android.application" version "8.3.2" apply false

but finally I figured it out by this command: flutter config --jdk-dir /Library/Java/JavaVirtualMachines/jdk-17.jdk/Contents/home change the argument to your own JDK path.

NurhayatYurtaslan commented 1 month ago

What should I do if the java version is 21. Should I update it to 17 and complete the other steps.

flavioa44 commented 1 month ago

What should I do if the java version is 21. Should I update it to 17 and complete the other steps.

Had the same issue and this worked -> link

hoanv810 commented 3 weeks ago

I have to downgrade Android Studio version to Koala 2024.1.2 Patch 1 and it works.

winneze1 commented 3 weeks ago

Any news, fail in ios

alextaymx commented 3 weeks ago

It doesn't work for me for this workaround: id "com.android.application" version "8.3.2" apply false

but finally I figured it out by this command: flutter config --jdk-dir /Library/Java/JavaVirtualMachines/jdk-17.jdk/Contents/home change the argument to your own JDK path.

This works for me

Niko191292 commented 3 weeks ago

It doesn't work for me for this workaround: id "com.android.application" version "8.3.2" apply false

but finally I figured it out by this command: flutter config --jdk-dir /Library/Java/JavaVirtualMachines/jdk-17.jdk/Contents/home change the argument to your own JDK path.

Dos not work for me in case I want to code native kotlin/java

RbVs commented 3 weeks ago

I had to downgrade Java to version 17 and change the version in settings.gradle from

id "com.android.application" version "7.3.0" apply false

to

id "com.android.application" version "8.7.0" apply false

Now it works without any issues. Important: Don’t forget to adjust the environment variable accordingly.

dipendra-sharma commented 2 weeks ago

Below is the complete steps for updating a Flutter Android app to support the latest Android Gradle Plugin (AGP) with all necessary changes.

android/app/build.gradle

plugins {
    id "com.android.application"
    id "kotlin-android"
    id "dev.flutter.flutter-gradle-plugin"
}

android {
    compileSdk = flutter.compileSdkVersion
    ndkVersion = "27.0.12077973"

    defaultConfig {
        minSdk = flutter.minSdkVersion
        targetSdk = flutter.targetSdkVersion
        versionCode = flutter.versionCode
        versionName = flutter.versionName
    }
}

android/gradle/wrapper/gradle-wrapper.properties

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-all.zip

android/build.gradle

subprojects {
    afterEvaluate {
        if (it.hasProperty('android')) {
            it.android.compileSdkVersion = 35
            it.android.defaultConfig.targetSdkVersion = 35
            it.android.compileOptions.sourceCompatibility = JavaVersion.VERSION_21
            it.android.compileOptions.targetCompatibility = JavaVersion.VERSION_21
            tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
                kotlinOptions.jvmTarget = JavaVersion.VERSION_21
            }
            if (it.android.namespace == null) {
                def manifest = new XmlSlurper().parse(file(it.android.sourceSets.main.manifest.srcFile))
                def packageName = manifest.@package.text()
                android.namespace = packageName
                println("Updating namespace ${packageName}")
            }
        }
    }
    project.buildDir = "${rootProject.buildDir}/${project.name}"
}

android/settings.gradle

includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")

repositories {
    google {
        content {
            includeGroupByRegex("com\\.android.*")
            includeGroupByRegex("com\\.google.*")
            includeGroupByRegex("androidx.*")
        }
    }
    mavenCentral()
    gradlePluginPortal()
}

plugins {
    id "dev.flutter.flutter-plugin-loader" version "1.0.0"
    id "com.android.application" version "8.7.1" apply false
    id "org.jetbrains.kotlin.android" version "2.0.20" apply false
}

Details

These changes update your Flutter Android project to be compatible with the latest AGP version, by specifying new plugin versions, aligning SDK levels, managing Java compatibility, and correctly configuring the build logic to align with the updates. Make sure to test your app thoroughly after making these changes to ensure stability and compatibility.

Nishant6199 commented 2 weeks ago

after changing these - ndkVersion = "27.0.12077973" in app/build.gradle, id "com.android.application" version "8.7.0" apply false this in settings.gradle

plugins { ------- this shows - Gradle execution is not trusted on this project. id "com.android.application" id "kotlin-android" // The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins. id "dev.flutter.flutter-gradle-plugin" }

android { namespace = "com.example.internet_checker_app" compileSdk = flutter.compileSdkVersion ndkVersion = "27.0.12077973"

compileOptions {
    sourceCompatibility = JavaVersion.VERSION_1_8
    targetCompatibility = JavaVersion.VERSION_1_8
}

kotlinOptions {
    jvmTarget = JavaVersion.VERSION_1_8
}

defaultConfig {
    // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
    applicationId = "com.example.internet_checker_app"
    // You can update the following values to match your application needs.
    // For more information, see: https://flutter.dev/to/review-gradle-config.
    minSdk = flutter.minSdkVersion
    targetSdk = flutter.targetSdkVersion
    versionCode = flutter.versionCode
    versionName = flutter.versionName
}

buildTypes {
    release {
        // TODO: Add your own signing config for the release build.
        // Signing with the debug keys for now, so `flutter run --release` works.
        signingConfig = signingConfigs.debug
    }
}

}

flutter { source = "../.." }

app/build.gradle file

allprojects { this line also shows --- Gradle execution is not trusted on this project. repositories { google() mavenCentral() } }

rootProject.buildDir = "../build" subprojects { project.buildDir = "${rootProject.buildDir}/${project.name}" } subprojects { project.evaluationDependsOn(":app") }

tasks.register("clean", Delete) { delete rootProject.buildDir } android/build.gradle file

how can i slove this after upgrading all

tedmarcin commented 1 week ago

My changes helps me to resolve this problem to use java 21 in my Flutter project:

android\settings.gradle

    plugins {
    id "dev.flutter.flutter-plugin-loader" version "1.0.0"
    id "com.android.application" version "8.7.1" apply false
    id "org.jetbrains.kotlin.android" version "1.9.24" apply false

}

android/app/build.gradle

distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-all.zip

android\gradle\wrapper\gradle-wrapper.jar

compileOptions {
        sourceCompatibility JavaVersion.VERSION_21
        targetCompatibility JavaVersion.VERSION_21
    }

is all changes after upgrade from koala to ladybug. if needed , do not forgot update flutter plugins to last version i.e. device_info_plus: ^11.1.0

if u get warnings about NDK ...

Your project is configured with Android NDK 23.1.7779620, but the following plugin(s) depend on a different Android NDK version:
- connectivity_plus requires Android NDK 27.0.12077973

Fix this issue by using the highest Android NDK version (they are backward compatible).
Add the following to  ......android\app\build.gradle:

    android {
        ndkVersion = "27.0.12077973"
        ...
    }

u can add this line or u comment this line like me

// ndkVersion = flutter.ndkVersion then i use current NDK :-)

renaldhif commented 1 week ago

It doesn't work for me for this workaround: id "com.android.application" version "8.3.2" apply false

but finally I figured it out by this command: flutter config --jdk-dir /Library/Java/JavaVirtualMachines/jdk-17.jdk/Contents/home change the argument to your own JDK path.

this works for me. thanks!

devwithmnasir commented 1 week ago
  1. Run the following command to clean up old build files: flutter clean

  2. Open the project in Android Studio. Launch the AGP Upgrade Assistant:

    • Go to the top menu, and select Tools. -Then, click on AGP Upgrade Assistant. Once complete, the issue will be resolved.
ohumidk commented 3 days ago
  1. Run the following command to clean up old build files: flutter clean

This helped me run my project. I will note that I do have warnings when I run my project but it works. I want to add a few more details to help with this.

  1. Open the project in Android Studio. Launch the AGP Upgrade Assistant:

    • Go to the top menu, and select Tools. -Then, click on AGP Upgrade Assistant. Once complete, the issue will be resolved.

In your finder/file explorer, go to your flutter project and navigate to your android folder. Open this in Android Studio, otherwise you will not be able to use the AGP Upgrade Assistant. Once you have opened your android folder in AS then you should be able to launch this AGP Upgrade Assistant.