0

I am tying to run flutter on android studio, I do not know if this part is relevant or not, but I have this weird error:

Launching lib/main.dart on sdk gphone64 x86 64 in debug mode...
Running Gradle task 'assembleDebug'...

Launching lib/main.dart on sdk gphone64 x86 64 in debug mode...
Running Gradle task 'assembleDebug'...

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processDebugGoogleServices'.
> File google-services.json is missing. The Google Services Plugin cannot function without it. 
   Searched Location: 
  /home/alex/StudioProjects/ictproject/android/app/src/debug/google-services.json
  /home/alex/StudioProjects/ictproject/android/app/src/google-services.json
  /home/alex/StudioProjects/ictproject/android/app/src/Debug/google-services.json
  /home/alex/StudioProjects/ictproject/android/app/google-services.json


* 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 6s
Exception: Gradle task assembleDebug failed with exit code 1

I do not know what to do, if you have any suggestion please tell me.

I think I found the problem but I am not sure, I did a "flutter doctor" and those are the results:

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.3.9, on Ubuntu 22.04.1 LTS 5.15.0-56-generic, locale en_US.UTF-8)
[!] Android toolchain - develop for Android devices (Android SDK version 33.0.1)
    ✗ cmdline-tools component is missing
      Run `path/to/sdkmanager --install "cmdline-tools;latest"`
      See https://developer.android.com/studio/command-line for more details.
    ✗ Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/docs/get-started/install/linux#android-setup for more details.
[✓] Chrome - develop for the web
[✓] Linux toolchain - develop for Linux desktop
[✓] Android Studio (version 2021.3)
[✓] IntelliJ IDEA Community Edition (version 2022.3)
[✓] VS Code (version 1.74.2)
[✓] Connected device (3 available)
[✓] HTTP Host Availability

! Doctor found issues in 1 category.

1 Answers1

0

The error indicates that you are missing the cmdline-tools component in your Android SDK, and the Android SDK licenses have not been accepted. You can resolve this issue by following these steps:

  1. First, you need to install cmdline-tools. You can do this by using the sdkmanager, which is a command line tool that allows you to view, install, update, and uninstall packages for the Android SDK. To do this, you need to run the following command:

    path/to/sdkmanager --install "cmdline-tools;latest"
    

    You should replace path/to/sdkmanager with the path where your sdkmanager is installed. If you are unsure where it is, you may need to search for it on your machine.

    Note that to run the above command, you need to have the ANDROID_HOME environment variable set, which is where the Android SDK is installed on your machine. You also need to have your Android platform's PATH updated to include tools and platform-tools.

  2. After installing cmdline-tools, you need to accept the Android SDK licenses. You can do this by running the following command:

    flutter doctor --android-licenses
    

    This command will present all licenses that have not been accepted and ask you to accept them. Press y to accept each license when prompted.

  3. After following the above steps, run flutter doctor again to check if all issues have been resolved:

    flutter doctor
    

I hope this solves your problem!