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

[Flutter] "Gradle task assembleDebug failed with exit code 1" because "Could not find or load...

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

  1. Stack

    Stack Membro Participativo

    I'm new to flutter and I want to make the default flutter app to show up on my Android emulator. The emulator starts up fine but the process fails at "gradle task assembleDebug". I reinstalled everything ranging from Android Studio to flutter and dart and also deleting the AVD from Android Studio then creating it again but nothing seems to work. I tried a few potential fixes from youtube and google searches involving running a "gradle wrapper" command at the root directory but that doesn't work too as the root directories of all flutter apps lacks the "build.gradle" file. Flutter doctor does not show any problems.

    "flutter doctor" command output:

    PS C:\Users\Mahmud Alam\Desktop\Programming Stuff\Flutter&Dart\newproj\firstapp> flutter doctor
    Doctor summary (to see all details, run flutter doctor -v):
    [√] Flutter (Channel stable, 3.0.1, on Microsoft Windows [Version 10.0.22000.675], locale en-US)
    Checking Android licenses is taking an unexpectedly long time...[√] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
    [√] Chrome - develop for the web
    [√] Visual Studio - develop for Windows (Visual Studio Community 2019 16.11.10)
    [√] Android Studio (version 2021.2)
    [√] VS Code (version 1.67.2)
    [√] Connected device (4 available)
    [√] HTTP Host Availability

    • No issues found!


    Error output in command line:

    PS C:\Users\Mahmud Alam\Desktop\Programming Stuff\Flutter&Dart\newproj\firstapp> flutter run
    Using hardware rendering with device sdk gphone x86. If you notice graphics artifacts, consider enabling software rendering with "--enable-software-rendering".
    Launching lib\main.dart on sdk gphone x86 in debug mode...
    'Dart\newproj\firstapp\android\' is not recognized as an internal or external command,
    operable program or batch file.
    Error: Could not find or load main class org.gradle.wrapper.GradleWrapperMain
    Caused by: java.lang.ClassNotFoundException: org.gradle.wrapper.GradleWrapperMain
    Running Gradle task 'assembleDebug'... 19.6s
    Exception: Gradle task assembleDebug failed with exit code 1


    I get the feeling that something is missing from somewhere but I cant figure out where and how to restore the files that are missing. Also, I'm running an emulation of Pixel 2 API 30 (android x86). But that alone should not cause any problems. How do I fix this?

    Edits: [Folder Structure Screenshots]

    [​IMG]

    [​IMG]

    [​IMG]

    [​IMG]

    [​IMG]

    [​IMG]

    [​IMG]

    [​IMG]

    Continue reading...

Compartilhe esta Página