Честно говоря, это решенная проблема, но я просто хочу поделиться решением, на случай, если кто-то получит такую же проблему.
Не удалось построить Android, и он сказал.
> cordova build android --release
Android Studio project detected
ANDROID_HOME=/usr/lib/android-sdk
JAVA_HOME=/usr/lib/jvm/jdk1.8.0_211
studio
Subproject Path: CordovaLib
Subproject Path: app
publishNonDefault is deprecated and has no effect anymore. All variants are now published.
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')
Checking the license for package Android SDK Build-Tools 27.0.1 in /usr/lib/android-sdk/licenses
Warning: License for package Android SDK Build-Tools 27.0.1 not accepted.
Checking the license for package Android SDK Platform 27 in /usr/lib/android-sdk/licenses
Warning: License for package Android SDK Platform 27 not accepted.
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':CordovaLib'.
> You have not accepted the license agreements of the following SDK components:
[Android SDK Platform 27, Android SDK Build-Tools 27.0.1].
Before building your project, you need to accept the license agreements and complete the installation of the missing components using the Android Studio SDK Manager.
Alternatively, to learn how to transfer the license agreements from one workstation to another, go to http://d.android.com/r/studio-ui/export-licenses.html
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
* Get more help at https://help.gradle.org
BUILD FAILED in 1s
/home/her/code/com.xxxx/platforms/android/gradlew: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':CordovaLib'.
> You have not accepted the license agreements of the following SDK components:
[Android SDK Platform 27, Android SDK Build-Tools 27.0.1].
Before building your project, you need to accept the license agreements and complete the installation of the missing components using the Android Studio SDK Manager.
Alternatively, to learn how to transfer the license agreements from one workstation to another, go to http://d.android.com/r/studio-ui/export-licenses.html
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
* Get more help at https://help.gradle.org
BUILD FAILED in 1s
Я много просмотрел, решение - запустить ./sdkmanager.sh --licenses, чтобы принять всю лицензию.
но я все еще получаю ошибку. Коротко говоря, я дважды проверил ошибку и обнаружил, что Ionic проверяет /usr/lib/android-sdk/
, а не /home/xxxx/android-sdk/
.
Итак, я скопировал принятые лицензии из /home/xxxx/android-sdk/licenses
в /usr/lib/android-sdk/licenses
.
Проблема решена.