0

I know this question was already posted, but I couldn't resolve my problem in any way. I'm developing an app with the Ionic Framework: I added the Android platform and built the apk flawlessly. Then I added the diagnostic plugin, and built again, but this time the action failed and gave me this error:

Error: cmd: Command failed with exit code 1 Error output:
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 Support Repository]. 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.

Since before installing the plugin the apk was built ok, I think the problem could lie there, but I don't know how to solve it.
Also, in my code I added this to check if GPS is enabled or not:

this.diagnostic.isLocationEnabled().then((state)=>{
  if(state){
    this.displayGPSError("Enabled")
  } else{
    this.displayGPSError("Not enabled")
  }
})

If I run the app with this piece of code in the browser, I get the following error:

Uncaught (in promise): cordova_not_available

Then, if I comment the piece of code, no error is shown on browser (but the apk building still doesn't work).

Usr
  • 2,628
  • 10
  • 51
  • 91
  • open your sdk manager.. install the support library and accept the licenses – Suraj Rao Nov 06 '17 at 12:01
  • I'm not working on Android Studio, how do I do that? And why was it working before, without installing the support library? – Usr Nov 06 '17 at 12:20
  • It probably is a dependency for diagnostic plugin.. maybe https://stackoverflow.com/questions/40383323/cant-accept-license-agreement-android-sdk-platform-24 will help – Suraj Rao Nov 06 '17 at 13:00

1 Answers1

0

The only way to solve the problem was to use the Android SDK Manager through Android Studio and install the updates indicated by the error message. I don't think there's another and faster solution.

Usr
  • 2,628
  • 10
  • 51
  • 91