3

After I carried out some commands below on terminal to test my unity app with android emulators. My Unity project started failing build over and over again due to the same error in the pics below. If there is anybody who are familiar with this issue, would you give me advice to address it?

The command I carried out on terminal

1, export PATH=$PATH:/Users/userName/Library/Android/sdk/platform-tools

2, echo PATH=$PATH: /Users/userName/Library/Android/sdk

3, cd /Users/userName/Desktop/AppName.apk

4, adb install AppName.apk

The details of the error

enter image description here

enter image description here

Kotaro
  • 147
  • 2
  • 12
  • 2
    Possible duplicate of [Failed to install the following Android SDK packages as some licences have not been accepted](https://stackoverflow.com/questions/52598897/failed-to-install-the-following-android-sdk-packages-as-some-licences-have-not-b) – Kaushik Burkule Oct 17 '19 at 07:12

7 Answers7

10

For people who may face the same errors in the future,

The problem was there is no licences file in /Users/username/Desktop/2019.2.9f1/PlaybackEngines/AndroidPlayer/SDK.

So I copied the file from /Users/username/Library/Android/sdk and paste it to the unity directory above.

The errors was successfully addressed.

I wish nobody wasted their time anymore because of this error.

Kotaro
  • 147
  • 2
  • 12
  • 1
    `/Applications/Unity/Hub/Editor/2021.2.19f1/PlaybackEngines/AndroidPlayer/SDK/tools/bin/sdkmanager --licenses` also works – Jacksonkr Aug 11 '22 at 18:17
7

Open command prompt as admin and run

{path_to_sdk_folder}/tools/bin/sdkmanager.bat --licenses

and accept all.

6

If anyone else happens to run into this problem, and you are using Unity Hub, run the following command from Terminal.

$ find /Applications/Unity/Hub/Editor -name "sdkmanager" -exec {} --licenses \;

This will find all of the installed SDKs and check that all licenses are accepted. If they aren't, you will be prompted to accept.

You can run the command again to double-check everything is 100%.

Scott Doxey
  • 311
  • 2
  • 7
  • I had to copy the generated licences across as per @Kotaro's answer. Running sdkmanager generated some errors for me, I think due to one of them not being compatible with the installed version of Java. – personalnadir Mar 21 '22 at 17:32
0

Keep bumping into this now Unity manages the platforms, Android Studio then grumbles about it if you point Android Studio at the platforms location Unity is using.

On Windows the quick and dirty fix is to run Android Studio as administrator, it then does what it needs and you can then go back to running Android Studio normally.

Not sure what the effects are long term, but it appears to work for me. Especially as I am not using the platform that Android Studio is grumbling about.

However, clearly, this isn't a great solution as the SDK manager in Android Studio doesn't see the platforms Unity claims to have installed.

Longmang
  • 1,663
  • 1
  • 13
  • 12
0

On a Windows machine, you'll need to find your sdkmanager.bat for your current version of Unity. For you this location could be something like

C:\Program Files\Unity\<version>\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\tools\bin\sdkmanager.bat

or

C:\Program Files\Unity\Hub\Editor\<version>\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\tools\bin\sdkmanager.bat

Once you find this, you can execute it with the --licenses flag in Powershell or your shell of choice, like below. Make sure that you run your shell as an administrator.

.\sdkmanager.bat --licenses

You'll then be prompted to review any licenses that have yet to be accepted. Answering y to these will resolve the issue.

Broper
  • 2,000
  • 1
  • 14
  • 15
0

Kotaro is right.

For people who may face the same errors in the future,

The problem was there is no licences file in /Users/username/Desktop/2019.2.9f1/PlaybackEngines/AndroidPlayer/SDK.

So I copied the file from /Users/username/Library/Android/sdk and paste it to the unity directory above.

The errors was successfully addressed.

I wish nobody wasted their time anymore because of this error.

Cant comment so :

This is correct but make sure you open CMD with admin privileges as it wont save the licenses!

-1

Go to src -> flutter -> flutter -> flutter_console and type flutter doctor --android-licenses. Click y.

karel
  • 5,489
  • 46
  • 45
  • 50