How to accept the sdk license agreements

I used the expo cli with react native to start a brand new app,
then I ran this command in the terminal

sudo keytool -genkey -v -keystore my-upload-key.keystore -alias my-key-alias -keyalg RSA -keysize 2048 -validity 10000

and put the password and other stuff like in the docs
then moved the my-upload-key.keystore file to the /src/android directory and edited the like in the docs
and after that i edited the build.gradle file in the /src/android/app directory like in the docs
then i ran the command in the docs
and it gave me an error saying that I need to set the sdk.dir in,
it works… well thats what I thought, it gave me another error

* What went wrong:
Could not determine the dependencies of task ':app:desugarReleaseFileDependencies'.
> Failed to install the following Android SDK packages as some licences have not been accepted.
     build-tools;30.0.2 Android SDK Build-Tools 30.0.2
     platforms;android-31 Android SDK Platform 31
  To build this project, accept the SDK license agreements and install the missing components using the Android Studio SDK Manager.
  Alternatively, to transfer the license agreements from one workstation to another, see
  Using Android SDK: /usr/lib/android-sdk

is there a way to accep the sdk license agreeements without using android studios sdk manager

That question is not really at all Gradle related.
You should probably ask in some Android community if you don’t get an answer here.
I at least cannot give any besides what the error message already told you.