Script mkdir cmd permission denied

I am trying to install a custom NDK version.
I followed the steps from this post

but I got a permission error:

+ mkdir /opt/android-ndk-tmp
mkdir: /opt/android-ndk-tmp: Permission denied
exit status 1

For context, I am trying to download NDK r21d version.
I am using the script after Flutter install and before cloning the repo.
I have also added the bitrise.yml update as mentioned.
Thanks.

Try with sudo that should work.

This script is also for Linux not MacOS I think

Correct, sudo makes it work, thanks. But I encounter another error with the cmd

+ wget -q https://dl.google.com/android/repository/android-ndk-r21d-darwin-aarch64.zip
exit status 3

Any idea how to do this in macOS m1 machines?

This works fine for me on M1

Can you open a support ticket so the team can look into this with support access

https://support.bitrise.io/hc/en-us/requests/new

Turns out I needed another sudo on the next step.
After fixing it I got NDK is not installed
Trying another method: sdkmanager "ndk;21.3.6528147"
But this still gave me another NDK error. :unityLibrary:BuildIl2CppTask

The flow is as follows:
Script → Repo clone → Caching → Flutter build.

For reference, I am using an embedded Unity project in Flutter. So, the NDK used to build should be the same as the NDK the Unity project got exported with. Which is 21.3.6528147.

Have you tried this step?

Using the sdkmanager also might be an option

Yes, I have tried both but didn’t work.

I tried this one after using sudo in my script. Got the NDK is not installed error

Tried this and got the recent :unityLibrary:BuildIl2CppTask: error