If this problem persists, try the following steps:
Create an Android SDK directory:
mkdir -p ~/android-sdk
Copy all files from the previous Android SDK:
Replace /nix/store/0wqd5nfc2hlx13davkvq2zf3zcy0wr61-androidsdk/libexec/android-sdk/ with the path to your existing Android SDK directory (you can find this in your error log). Then run:
Don’t do anything more for this. Just run the following command: flutter config --android-sdk /nix/store/0wqd5nfc2hlx13davkvq2zf3zcy0wr61-androidsdk/libexec/android-sdk/* ~/android-sdk/
2025-01-25T17:57:34Z [android] Flutter daemon started
2025-01-25T17:57:35Z [android] Launching lib/main.dart on sdk gphone64 x86 64 in debug mode…
2025-01-25T17:57:36Z [android] Running Gradle task ‘assembleDebug’…
2025-01-25T17:58:19Z [android] Checking the license for package Android SDK Build-Tools 33.0.1 in /home/user/android-sdk/licenses
2025-01-25T17:58:19Z [android] Warning: License for package Android SDK Build-Tools 33.0.1 not accepted.
2025-01-25T17:58:19Z [android] Checking the license for package Android SDK Platform 34 in /home/user/android-sdk/licenses
2025-01-25T17:58:19Z [android] Warning: License for package Android SDK Platform 34 not accepted.
2025-01-25T17:58:19Z [android] Error:
2025-01-25T17:58:19Z [android]
2025-01-25T17:58:19Z [android] Error: FAILURE: Build failed with an exception.
2025-01-25T17:58:19Z [android]
2025-01-25T17:58:19Z [android] * What went wrong:
2025-01-25T17:58:19Z [android] Could not determine the dependencies of task ‘:app:compileDebugJavaWithJavac’.
2025-01-25T17:58:19Z [android]
2025-01-25T17:58:19Z [android] Error: > Failed to install the following Android SDK packages as some licences have not been accepted.
2025-01-25T17:58:19Z [android] platforms;android-34 Android SDK Platform 34
2025-01-25T17:58:19Z [android]
2025-01-25T17:58:19Z [android] Error: build-tools;33.0.1 Android SDK Build-Tools 33.0.1
2025-01-25T17:58:19Z [android] To build this project, accept the SDK license agreements and install the missing components using the Android Studio SDK Manager.
2025-01-25T17:58:19Z [android] All licenses can be accepted using the sdkmanager command line tool:
2025-01-25T17:58:19Z [android] sdkmanager.bat --licenses
2025-01-25T17:58:19Z [android] Or, to transfer the license agreements from one workstation to another, see Update the IDE and SDK tools | Android Studio | Android Developers
2025-01-25T17:58:19Z [android]
2025-01-25T17:58:19Z [android] Using Android SDK: /home/user/android-sdk
[✓] Flutter (Channel stable, 3.29.0, on IDX GNU/Linux 6.1.124+, locale en_US.UTF-8) [39ms]
• Flutter version 3.29.0 on channel stable at /home/user/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 35c388afb5 (11 days ago), 2025-02-10 12:48:41 -0800
• Engine revision f73bfc4522
• Dart version 3.7.0
• DevTools version 2.42.2
[✗] Android toolchain - develop for Android devices [40ms]
• Android SDK at /nix/store/w42qkfz3z0insr7z83402anmk1kjv0vn-android-sdk-platform-tools-34.0.5/libexec/android-sdk
✗ cmdline-tools component is missing
Run `path/to/sdkmanager --install "cmdline-tools;latest"`
See https://developer.android.com/studio/command-line for more details.
[✗] Chrome - develop for the web (Cannot find Chrome executable at google-chrome) [21ms]
! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.
[✗] Linux toolchain - develop for Linux desktop [40ms]
✗ clang++ is required for Linux development.
It is likely available from your distribution (e.g.: apt install clang), or can be downloaded from https://releases.llvm.org/
✗ CMake is required for Linux development.
It is likely available from your distribution (e.g.: apt install cmake), or can be downloaded from https://cmake.org/download/
✗ ninja is required for Linux development.
It is likely available from your distribution (e.g.: apt install ninja-build), or can be downloaded from https://github.com/ninja-build/ninja/releases
✗ pkg-config is required for Linux development.
It is likely available from your distribution (e.g.: apt install pkg-config), or can be downloaded from https://www.freedesktop.org/wiki/Software/pkg-config/
[!] Android Studio (not installed) [19ms]
• Android Studio not found; download from https://developer.android.com/studio/index.html
(or visit https://flutter.dev/to/linux-android-setup for detailed instructions).
[✓] Connected device (3 available) [146ms]
• sdk gphone64 x86 64 (mobile) • emulator-5554 • android-x64 • Android 14 (API 34) (emulator)
• sdk gphone64 x86 64 (mobile) • localhost:5555 • android-x64 • Android 14 (API 34) (emulator)
• Linux (desktop) • linux • linux-x64 • IDX GNU/Linux 6.1.124+
[✓] Network resources [604ms]
• All expected network resources are available.
I also had such a problem. The way to fix this is to recreate the project. Publish your flutter app on github. And on the idx main page, select “Import Repository”, paste your github repository URL, click on the “This is a flutter application” checkbox and click “Import”. Done this may solve this problem. It worked for me.