how to fix “Failed to install 'cordova-plugin-console':Error ”

廉价感情. 提交于 2019-12-11 06:54:59

问题


I am trying to make apk file. I have android studio with sdk installed and jdk. But when i try to add android package to my ionic folder. I get this error

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'android'.
> You have not accepted the license agreements of the following SDK components:
[Android SDK Platform 24].
Before building your project, you need to accept the license agreements and comp
lete the installation of the missing components using the Android Studio SDK Man
ager.
Alternatively, to learn how to transfer the license agreements from one workstat
ion 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.



BUILD FAILED




Total time: 44.28 secs

Failed to install 'cordova-plugin-console':Error: cmd: Command failed with exit
code 1
    at ChildProcess.whenDone (C:\ionic\lcalc\platforms\android\cordova\node_modu
les\cordova-common\src\superspawn.js:169:23)
    at emitTwo (events.js:106:13)
    at ChildProcess.emit (events.js:191:7)
    at maybeClose (internal/child_process.js:877:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
Error: cmd: Command failed with exit code 1

Help :(


回答1:


The CLI prints the exact reason for the build failure. Notice the lines as :

A problem occurred configuring root project 'android'.
> You have not accepted the license agreements of the following SDK components:
[Android SDK Platform 24].

So Open your SDK Manager ( you might need to open as administrator if you are not an admin)

Install the required SDK version. Look at the attached image




回答2:


Install platform 24 in your sdk.

or

Try removing the plugin.

cordova plugin rm cordova-plugin-console



回答3:


I had the same issue. Solved by updating android studio.

  1. Open the Preferences window by clicking File > Settings (on Mac, Android Studio > Preferences).
  2. In the left panel, click Appearance & Behavior > System Settings > Updates.
  3. Be sure that Automatically check for updates is checked, then select "stable channel" from the drop-down list.
  4. Click Apply or OK.

that's really the easyest way.

anyway you can update just the sdk manager from command line (with administrator priviledge) :

cd path/to/your/android-sdk/tools/bin/
./sdkmanager.bat --update

that's all, hope this help you!



来源:https://stackoverflow.com/questions/41090061/how-to-fix-failed-to-install-cordova-plugin-consoleerror

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!