javaandroidcordovahtml-framework-7android-sdk-manager

License for package Android SDK Platform 29 not accepted


I installed cordova in Ubuntu 20.04 and when I try to build, I see the message License for package Android SDK Platform 29 not accepted

I already do sdkmanager --license and accept all licenses, but it still happening. What's wrong?

My environment set in .bashrc

export ANDROID_SDK_ROOT=/usr/lib/android-sdk
export ANDROID_HOME=/usr/lib/android-sdk
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
export PATH=${PATH}:/usr/lib/android-sdk/platform-tools:/usr/lib/android-sdk/tools
export PATH=$ANDROID_HOME/cmdline-tools/tools/bin:$PATH

Full error message:

Checking Java JDK and Android SDK versions
ANDROID_SDK_ROOT=undefined (recommended setting)
ANDROID_HOME=undefined (DEPRECATED)
Using Android SDK: /usr/lib/android-sdk
Subproject Path: CordovaLib
Subproject Path: app
Starting a Gradle Daemon, 1 incompatible and 1 stopped Daemons could not be reused, use --status for details

> Configure project :CordovaLib
[Cordova] cdvMinSdkVersion is overridden, try it at your own risk.
WARNING: The specified Android SDK Build Tools version (27.0.1) is ignored, as it is below the minimum supported version (29.0.2) for Android Gradle Plugin 4.0.0.
Android SDK Build Tools 29.0.2 will be used.
To suppress this warning, remove "buildToolsVersion '27.0.1'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.
WARNING: The specified Android SDK Build Tools version (27.0.1) is ignored, as it is below the minimum supported version (29.0.2) for Android Gradle Plugin 4.0.0.
Android SDK Build Tools 29.0.2 will be used.
To suppress this warning, remove "buildToolsVersion '27.0.1'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.
Observed package id 'build-tools;debian' in inconsistent location '/usr/lib/android-sdk/build-tools/27.0.1' (Expected '/usr/lib/android-sdk/build-tools/debian')
Observed package id 'build-tools;debian' in inconsistent location '/usr/lib/android-sdk/build-tools/27.0.1' (Expected '/usr/lib/android-sdk/build-tools/debian')
File /root/.android/repositories.cfg could not be loaded.
Checking the license for package SDK Patch Applier v4 in /usr/lib/android-sdk/licenses
Warning: License for package SDK Patch Applier v4 not accepted.
Checking the license for package Android Emulator in /usr/lib/android-sdk/licenses
Warning: License for package Android Emulator not accepted.
Checking the license for package Android SDK Tools in /usr/lib/android-sdk/licenses
Warning: License for package Android SDK Tools not accepted.
Checking the license for package Android SDK Build-Tools 29.0.2 in /usr/lib/android-sdk/licenses
Warning: License for package Android SDK Build-Tools 29.0.2 not accepted.
Checking the license for package Android SDK Platform 29 in /usr/lib/android-sdk/licenses
Warning: License for package Android SDK Platform 29 not accepted.

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
> Failed to install the following Android SDK packages as some licences have not been accepted.
     patcher;v4 SDK Patch Applier v4
     platforms;android-29 Android SDK Platform 29
     emulator Android Emulator
     tools Android SDK Tools
     build-tools;29.0.2 Android SDK Build-Tools 29.0.2
  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 http://d.android.com/r/studio-ui/export-licenses.html
  
  Using Android SDK: /usr/lib/android-sdk

* Try:
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.

* Get more help at https://help.gradle.org

BUILD FAILED in 29s
Command failed with exit code 1: /home/pedro/Developer/Apps/MyApp/cordova/platforms/android/gradlew cdvBuildDebug -b /home/pedro/Developer/Apps/MyApp/cordova/platforms/android/build.gradle
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! my-app@1.0.0 build-cordova-android: `node ./build/build.js && cd cordova && cordova build android`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the my-app@1.0.0 build-cordova-android script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2021-06-05T11_01_39_133Z-debug.log

Solution

  • To solve it, I had to install Android Studio. The same error appear, but in one click I was redirected to a GUI, with a screen to accept and download SDK Platform 29