[Solved] Gradle build error: not accepted licenses

Just sharing fix I did for gradle build error in Unity 6, the error part was

Could not determine the dependencies of task ‘:unityLibrary:GoogleMobileAdsPlugin.androidlib:generateReleaseRFile’.

Then there was info about not-accepted licenses, and using sdkManager --licenses, which didn’t work.

The fix was to

  • delete all files from the build folder,
  • set Minimum and Target Android API in ProjetctSettings to 31. Then build, and a blue window should appear installing API 31. Then restore Minimum and Target Android APIs.

Hope it helps someone.

3 Likes

Tried to fix this issue and now it gives me another:
"* What went wrong:
Could not determine the dependencies of task ‘:unityLibrary:GoogleMobileAdsPlugin.androidlib:generateReleaseRFile’.

Failed to install the following SDK components:
build-tools;30.0.3 Android SDK Build-Tools 30.0.3
The SDK directory is not writable (C:\Program Files\Unity\Hub\Editor\2022.3.31f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK)"

for

The SDK directory is not writable

Run Unity Hub as Administrator, and start Unity from there and build
source

1 Like

It’s crazy how this issue appeared in an LTS release and was never fixed - it affects everyone (Mac+Windows Users) and cannot be circumvented