Search code examples
androidflutterandroid-studiovisual-studio-code

A failure occurred while executing com.android.build.gradle.internal.tasks.DexFileDependenciesTask$DexFileDependenciesWorkerAction


enter image description here

PLEASE IF anyone can help me fix this errors i tried alot of things in android studio i have jdk 20 and gradle 8.3 i tried run the app using vs code and still the same errors please if anyone can help me solve those errors i tried everything i tried to uninstall the command line tools and install them again from android sdk manager in andorid studio and still the same errors appear as well


Solution

  • It looks like your issue might be related to a corrupt Gradle cache, SDK, or an incompatibility with JDK 20. Here’s a step-by-step way to fix it:

    Clear the Gradle cache (~/.gradle/caches) and run flutter clean followed by flutter pub get and then flutter run.

    Downgrade to JDK 17 or 11, as JDK 20 might not be fully supported. Update your JAVA_HOME to point to the new JDK and verify it with java -version.

    Open Android Studio > SDK Manager, uninstall the Android SDK Command-line Tools, and reinstall the latest version.

    Ensure your gradle-wrapper.properties has a compatible version, like Gradle 8.3 if that matches your Android plugin version.

    Run flutter upgrade, then clean and rebuild your project (flutter clean and flutter pub get).

    If the problem persists, delete your Android SDK folder and reinstall it from scratch through Android Studio.

    Run flutter channel stable and flutter upgrade to ensure you're on the most stable setup.

    Run flutter run --verbose to get detailed logs that might give more clues about the issue.

    Try these steps, and let me know how it goes! Happy to help further if needed.