Can't compile Android : To build this project, accept the SDK license agreements and install the missing components using the Android Studio SDK Manager.

Hello,

I got the following error when building on Android :

Here is the stacktrace :

Parallel execution with configuration on demand is an incubating feature.
The Task.leftShift(Closure) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use Task.doLast(Action) instead.
	at build_a9uydmmhn77pqdiktyzizamyr.run(/app/workingdir/android/sdk31/android-shell-app/ReactAndroid/build.gradle:141)
	(Run with --stacktrace to get the full stack trace of this deprecation warning.)
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
Checking the license for package Android SDK Build-Tools 27.0.3 in /usr/local/android-sdk-linux/licenses
Warning: License for package Android SDK Build-Tools 27.0.3 not accepted.
Checking the license for package Android SDK Platform 27 in /usr/local/android-sdk-linux/licenses
Warning: License for package Android SDK Platform 27 not accepted.
Checking the license for package Android SDK Build-Tools 27.0.3 in /usr/local/android-sdk-linux/licenses
Warning: License for package Android SDK Build-Tools 27.0.3 not accepted.
Checking the license for package Android SDK Platform 27 in /usr/local/android-sdk-linux/licenses
Warning: License for package Android SDK Platform 27 not accepted.
[stderr] FAILURE: Build failed with an exception.
[stderr] * What went wrong:
[stderr] A problem occurred configuring project ':ReactAndroid'.
[stderr] > Failed to notify project evaluation listener.
[stderr]    > Failed to install the following Android SDK packages as some licences have not been accepted.
[stderr]         platforms;android-27 Android SDK Platform 27
[stderr]         build-tools;27.0.3 Android SDK Build-Tools 27.0.3
[stderr]      To build this project, accept the SDK license agreements and install the missing components using the Android Studio SDK Manager.
[stderr]      Alternatively, to transfer the license agreements from one workstation to another, see http://d.android.com/r/studio-ui/export-licenses.html
[stderr]      
[stderr]      Using Android SDK: /usr/local/android-sdk-linux
[stderr]    > Failed to install the following Android SDK packages as some licences have not been accepted.
[stderr]         platforms;android-27 Android SDK Platform 27
[stderr]         build-tools;27.0.3 Android SDK Build-Tools 27.0.3
[stderr]      To build this project, accept the SDK license agreements and install the missing components using the Android Studio SDK Manager.
[stderr]      Alternatively, to transfer the license agreements from one workstation to another, see http://d.android.com/r/studio-ui/export-licenses.html
[stderr]      
[stderr]      Using Android SDK: /usr/local/android-sdk-linux
[stderr] * Try:
[stderr] Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
[stderr] * Get more help at https://help.gradle.org
[stderr] BUILD FAILED in 11s
Error: Process exited with non-zero code: 1
    at ChildProcess.child.on (/app/node_modules/@expo/spawn-async/build/spawnAsync.js:39:21)
    at emitTwo (events.js:126:13)
    at ChildProcess.emit (events.js:214:7)
    at maybeClose (internal/child_process.js:915:16)```

Any ideas ? Is the problem because of me or Expo servers ?
5 Likes

I am getting the same. This is definitely an Expo error, as I have made no changes except change paddingTop style from 10 to 5.

3 Likes

Same here. Does anyone have a solution?

:frowning:

1 Like

I got the same error.

1 Like

same for me. Maybe they are running maintenance?

Hey. I had the same issue.
I solved it by (1) accepting the licenses** and (2) copying the ā€˜licensesā€™ folder into my sdk folder (as explained here: Update the IDE and SDK Tools Ā |Ā  Android Developers)

__
** Not sure whether it was actually a necessary step, but it was something Iā€™d tried first

  1. Navigate to sdkmanager.
    ~/Library/Android/sdk/tools/bin
  2. run sdkmanager
    ./sdkmanager --licenses
3 Likes

The same problem here, it just happened after i updated from 27 to 32. Anyone knows if lower version it works?

I tried again and it worked well, i did nothing.

Iā€™m seeing the same error also, but randomly my Android build does compile. It may be that the machine rendering our builds may not be updated with proper SDKs but some of them are. Iā€™ve been able to get a few builds through, but took lots of attempts.

Just got another to go through after 4 failed attempts.

3 Likes

Cool. This is working.

As mistle say:

1.-Download the option you need from https://developer.android.com/studio/?hl=es-419
2.-Then, unzip the files and open a command window. (I put the extracted files in C :slight_smile:
In the command window go to the folder ā†’ bin and execute:
sdkmanager --licenses
It takes a little, here only accept the licenses.

Thanks mistle

1 Like

Thank you!

I have the same problem. It seems to appear randomly, sometimes build succeeds but most of the time it fails with error about license.
I have no idea how can I accept licenses on build machine it seems to be impossible.

We need quick fix we cannot upload our APK because of that. We believe expo team

1 Like

Same issue, sometimes with 28, others with 27. Tried ten times.

Still same issue tried over ten times

[stderr] FAILURE: Build failed with an exception.
[stderr] * What went wrong:
[stderr] A problem occurred configuring project ā€˜:appā€™.
[stderr] > Failed to install the following Android SDK packages as some licences have not been accepted.
[stderr] platforms;android-27 Android SDK Platform 27
[stderr] build-tools;28.0.3 Android SDK Build-Tools 28.0.3
[stderr] To build this project, accept the SDK license agreements and install the missing components using the Android Studio SDK Manager.
[stderr] Alternatively, to transfer the license agreements from one workstation to another, see Exporting licenses - Android Studio Project Site
[stderr]
[stderr] Using Android SDK: /usr/local/android-sdk-linux
[stderr] * Try:
[stderr] Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
[stderr] * Get more help at https://help.gradle.org
[stderr] BUILD FAILED in 13s
Error: Process exited with non-zero code: 1
at ChildProcess.child.on (/app/node_modules/@expo/spawn-async/build/spawnAsync.js:39:21)
at emitTwo (events.js:126:13)
at ChildProcess.emit (events.js:214:7)
at maybeClose (internal/child_process.js:915:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)

Itā€™s not working (again), keep getting the same issue, when trying to build APK.

I donā€™t use Android Studio to build the apps. I use Visual Studio Code , so i execute ā€œexpo build:androidā€ from the terminal.

I believe Expo team need to fix on the licenses issue on the build machine.

5 Likes

Still not working

2 Likes

tried this before, and nothing happenedā€¦ the error still coming up when i try build the apk

2 Likes

Same issue here. Accepting the licenses via the sdkmanager did nothing for me.

1 Like