A problem occurred configuring root project 'android'.Error when try to build apk file

C:\dreamhouse-mobile-ionic>ionic build android

Running ‘build:before’ npm script before build

ionic-hello-world@ build C:\dreamhouse-mobile-ionic
ionic-app-scripts build

[10:56:11] ionic-app-scripts 0.0.38
[10:56:11] build prod started …
[10:56:11] clean started …
[10:56:11] clean finished in 12 ms
[10:56:11] copy started …
[10:56:11] ngc started …
[10:56:11] copy finished in 297 ms
[10:56:11] lint started …
[10:56:16] lint finished in 4.36 s
[10:56:48] ngc finished in 36.96 s
[10:56:48] webpack started …
[10:56:58] webpack finished in 10.69 s
[10:56:58] uglifyjs started …
[10:56:58] sass started …
[10:57:01] sass finished in 2.87 s
[10:57:01] cleancss started …
[10:57:03] cleancss finished in 2.17 s
[10:57:18] uglifyjs finished in 19.32 s
[10:57:18] build prod finished in 67.00 s
ANDROID_HOME=C:\Users\piyush\AppData\Local\Android\android-sdk

JAVA_HOME=C:\Program Files\Java\jdk1.8.0_112

Subproject Path: CordovaLib

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 25].
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.

BUILD FAILED

Total time: 2.972 secs

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 SDK Platform 25].
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.

C:\dreamhouse-mobile-ionic>ionic run android

Running ‘run:before’ npm script before run

ionic-hello-world@ build C:\dreamhouse-mobile-ionic
ionic-app-scripts build

[11:00:08] ionic-app-scripts 0.0.38
[11:00:08] build prod started …
[11:00:08] clean started …
[11:00:08] clean finished in 10 ms
[11:00:08] copy started …
[11:00:08] ngc started …
[11:00:08] copy finished in 590 ms
[11:00:09] lint started …
[11:00:17] lint finished in 7.96 s
[11:00:54] ngc finished in 46.40 s
[11:00:54] webpack started …
[11:01:04] webpack finished in 9.79 s
[11:01:04] uglifyjs started …
[11:01:04] sass started …
[11:01:07] sass finished in 2.79 s
[11:01:07] cleancss started …
[11:01:10] cleancss finished in 3.33 s
[11:01:25] uglifyjs finished in 21.25 s
[11:01:25] build prod finished in 77.48 s
ANDROID_HOME=C:\Users\piyush\AppData\Local\Android\android-sdk

JAVA_HOME=C:\Program Files\Java\jdk1.8.0_112

Subproject Path: CordovaLib

FAILURE:
Build failed with an exception.

BUILD FAILED

Total time: 7.72 secs

  • 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 25].
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.

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 SDK Platform 25].
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

1 Like

I am also facing the same issue.
Please help to come out of it