建立Android SDK 27时离子失败

时间:2019-07-02 15:28:19

标签: android ionic-framework sdk

老实说,这是已解决的问题,但我只想分享解决方案,以防万一有人遇到相同的问题。

编译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接受所有许可证。

但是,我仍然会收到错误消息。简而言之,我仔细检查了错误,发现离子检查/usr/lib/android-sdk/而不是/home/xxxx/android-sdk/。 因此,我将接受的许可证从/home/xxxx/android-sdk/licenses复制到了/usr/lib/android-sdk/licenses

问题已解决。

0 个答案:

没有答案