Flutter - Android SDK Folder Not Writable (Temporary Problem Solved

If this problem persists, try the following steps:

  1. Create an Android SDK directory:

mkdir -p ~/android-sdk

  1. 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:

cp -r /nix/store/0wqd5nfc2hlx13davkvq2zf3zcy0wr61-androidsdk/libexec/android-sdk/* ~/android-sdk/

  1. Configure the new directory as the Flutter Android SDK:

flutter config --android-sdk ~/android-sdk

  1. Add the path variable in Nix:
    Set the ANDROID_SDK_ROOT environment variable:

export ANDROID_SDK_ROOT=~/android-sdk

  1. Make it persistent:
    Append the environment variable to your ~/.bashrc file:

echo "export ANDROID_SDK_ROOT=~/android-sdk" >> ~/.bashrc

source ~/.bashrc

  1. Grant read and write permissions:

chmod -R 755 ~/android-sdk

  1. Done!

Now, run the Flutter build command:

flutter build

6 Likes

so what if the problem is fixed how do reverse the changes made, and use the nix store adriod sdk

1 Like

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/

2 Likes

is this code for fixing or reversing the changes?

1 Like

To delete the newly created Android SDK directory, use the following command:
rm -rf ~/android-sdk

2 Likes

hightechsgyan its working thank you very much thats work

2 Likes

It works, thank you very much @hightechsgyan

1 Like

Thanks a lot. It worked. Grateful <3

Now i’m getting this error.

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

You have to accept the android licenses since it a custom android sdk being used;
To resolve this, run: flutter doctor --android-licenses

@Idx.dev hasn’t the problem being fixed yet?

Android sdkmanager not found. Update to the latest Android SDK and ensure that the cmdline-tools are installed to resolve this.