Fixing the Gradle Task AssembleDebug Failure with Exit Code -1: A Guide

1. Compile a list of all URLs required.
2. Edit the gradle file.
3. Ensure that the given repositories are also added to flutter.gradle.
4. Close Android Studio.
5. Remove the .gradle folder located at C:Users{Your User}.
6. Reopen Android Studio and build the project once more.
Question:
While running the Flutter app on an Android emulator, an exception is thrown. The app works fine on iOS. How can this be resolved?
Solution:
Navigate to the Terminal tab located at the bottom of the Android Studio screen. Copy and paste the below statement into the terminal and execute it.
C:UsersDELLAppDataLocalAndroidsdktoolsbinsdkmanager –update

Question:

Today, I installed
android studio
for Flutter by following the instructions provided on the official website. Despite my efforts, I encountered various problems at different stages.

The series of events were as follows: I attempted to launch the application, however, the Gradle task assembleDebug continued to load. Upon investigation, I discovered that the Android API 28 needed to be installed. After installing the API, the next step was to proceed.

C:UsersDELLAndroidStudioProjectsexample>flutter run
Launching libmain.dart on ASUS X00TD in debug mode...
Running Gradle task 'assembleDebug'...
Running Gradle task 'assembleDebug'... Done                        38.3s
Gradle task assembleDebug failed with exit code -1

While surfing the web, I came across a suggestion that stood out – to download the ‘Android SDK Tools (Obsolete)’. However, it turned out that I had already installed it.

Click Here For The Snapshot

  1. Currently displaying on
    flutter doctor
C:UsersDELL>flutter doctor -v
[√] Flutter (Channel stable, v1.12.13+hotfix.5, on Microsoft Windows [Version 10.0.17763.914], locale en-US)
    • Flutter version 1.12.13+hotfix.5 at C:flutterflutter
    • Framework revision 27321ebbad (6 months ago), 2019-12-10 18:15:01 -0800
    • Engine revision 2994f7e1e6
    • Dart version 2.7.0
[!] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
    • Android SDK at C:UsersDELLAppDataLocalAndroidsdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-29, build-tools 29.0.3
    • Java binary at: C:Program FilesAndroidAndroid Studiojrebinjava
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
    X Android license status unknown.
      Try re-installing or updating your Android SDK Manager.
      See https://developer.android.com/studio/#downloads or visit https://flutter.dev/setup/#android-setup for detailed
      instructions.
[√] Android Studio (version 4.0)
    • Android Studio at C:Program FilesAndroidAndroid Studio
    • Flutter plugin version 46.0.2
    • Dart plugin version 193.7361
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
[√] VS Code (version 1.45.1)
    • VS Code at C:UsersDELLAppDataLocalProgramsMicrosoft VS Code
    • Flutter extension version 3.11.0

While surfing the internet once more, I discovered that this issue could be related to the installation of ‘Android SDK Tools (Obsolete)’, which was also suggested as a solution before.

  1. Upon executing

    flutter doctor --android-licenses

    , it became evident that

    sdkmanager

    was absent. Consequently, I procured the commandtoollines manually from the Android Studio website. This version included ‘sdkmanager.bat’, which was lacking in the original. I then inserted it into the designated folder. However, I am now encountering a fresh error.
C:UsersDELL>flutter doctor --android-licenses
A newer version of the Android SDK is required. To update, run:
C:UsersDELLAppDataLocalAndroidsdktoolsbinsdkmanager --update

I would be immensely grateful if someone could lend me a hand.


Solution:

The Terminal tab can be found at the bottom of the Android Studio screen.

Execute the below command in the terminal to update the SDK manager:
C:UsersDELLAppDataLocalAndroidsdktoolsbinsdkmanager –update

After the update is complete, everything should work smoothly. However, if issues persist, additional statements may need to be executed to identify missing components. The installation process for Android Studio can be cumbersome due to its reliance on multiple factors for proper operation.

Frequently Asked Questions