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