I am facing difficulties setting the sdk.dir and ndk.dir paths on my MacBook M2 Pro for my React Native project. I have tried several workarounds, but none of them seem to be working.
My current setup includes:
- Node v14.13.0
- NPM v6.14.8
- React-Native v0.63.3.
For a temporary fix, I have been adding the following two lines to my local.properties file:
sdk.dir=/Users/REDACTED/Library/Android/sdk
ndk.dir=/Users/REDACTED/Library/Android/sdk/ndk/21.1.6352462
If the ndk.dir is not properly set, I get an error message that reads "No version of NDK matched the requested version 21.0.6113669. Versions available locally: 21.1.6352462, 21.4.7075529." This is because the required NDK does not exist in my Android Studio, so I have to hardcode it inside the local.properties file.
If the sdk.dir is not properly set, I get an error message that reads "SDK location not found. Define location with an ANDROID_SDK_ROOT environment variable or by setting the sdk.dir path in your project's local properties file at '/Users/REDACTED_PROJECT_NAME/android/local.properties'."
Based on my current setup and requirements, I am hoping to set the ndk.dir and sdk.dir paths globally to avoid having to modify the local.properties file every time I switch to another branch. I would like these paths to be set globally and automatically detected by my React Native project.
