Ionic-cli: A problem occurred configuring root project 'android'.

Created on 1 Jun 2017  路  19Comments  路  Source: ionic-team/ionic-cli

_From @djereg on May 31, 2017 23:24_

Type: bug

Ionic Version: 2.x

Platform: android 5.0 webview

Attempting to set app name
Setting App Name: T枚r枚kb谩lint Ma
ANDROID_HOME=/usr/local/src/android-sdk-linux
JAVA_HOME=/usr/lib/jvm/java-8-oracle
Subproject Path: CordovaLib
Incremental java compilation is an incubating feature.

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.
    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: 1.897 secs
Error: /home/package/workspace/apps-54624e0c-168/cordova/platforms/android/gradlew: 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.
    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.

_Copied from original issue: ionic-team/ionic#11882_

Most helpful comment

I solved the issue by updating android platform version.
ionic cordova platform update android

Installed platforms:
  android 6.2.3
  ios 4.4.0

All 19 comments

@djereg Looks like your builds were succeeding a few days ago. What changed in your app?

@dwieeb Nothing man, really nothing. After successful build only some HTML, JS and CSS. Before ionic and cordova pulgin updates, but I think the before is not important.

Tried cordova android 6.2.3 but #211

global packages:

    @ionic/cli-utils : 1.3.0
    Cordova CLI      : 7.0.1
    Ionic CLI        : 3.3.0

local packages:

    @ionic/app-scripts              : 1.3.7
    @ionic/cli-plugin-cordova       : 1.3.0
    @ionic/cli-plugin-ionic-angular : 1.3.0
    Cordova Platforms               : android 6.1.2 ios 4.4.0
    Ionic Framework                 : ionic-angular 3.3.0

System:

    Node       : v7.10.0
    OS         : Windows 10
    Xcode      : not installed
    ios-deploy : not installed
    ios-sim    : not installed

@djereg Other builds on the same machine appear to be succeeding. Can you do cordova plugin ls ?

cordova-plugin-app-name 1.0.0 "App Namer"
cordova-plugin-app-version 0.1.9 "AppVersion"
cordova-plugin-apprate 1.2 "AppRate"
cordova-plugin-camera 2.4.0 "Camera"
cordova-plugin-compat 1.1.0 "Compat"
cordova-plugin-device 1.1.5 "Device"
cordova-plugin-dialogs 1.3.2 "Notification"
cordova-plugin-facebook4 1.7.4 "Facebook Connect"
cordova-plugin-geolocation 2.4.2 "Geolocation"
cordova-plugin-globalization 1.0.6 "Globalization"
cordova-plugin-google-analytics 1.7.9 "Google Universal Analytics Plugin"
cordova-plugin-inappbrowser 1.7.0 "InAppBrowser"
cordova-plugin-ios-non-exempt-encryption 1.0.0 "ITSAppUsesNonExemptEncryption false"
cordova-plugin-network-information 1.3.2 "Network Information"
cordova-plugin-screen-orientation 2.0.0 "Screen Orientation"
cordova-plugin-splashscreen 4.0.2 "Splashscreen"
cordova-plugin-statusbar 2.2.2 "StatusBar"
cordova-plugin-whitelist 1.3.2 "Whitelist"
cordova-plugin-wkwebview-engine 1.1.2 "Cordova WKWebView Engine"
cordova-sqlite-storage 2.0.3 "Cordova sqlite storage plugin"
es6-promise-plugin 4.1.0 "Promise"
ionic-plugin-keyboard 2.2.1 "Keyboard"
onesignal-cordova-plugin 2.0.11 "OneSignal Push Notifications"

@dwieeb You found something?

@djereg Does your app build locally? You should be able to compile an Android project on any OS.

@dwieeb Yes, of course. Tested it on Windows 10 and on Sierra Mac OS.

ionic cordova run android --prod --device
ionic cordova run ios --prod --target="iPhone-6s"

Both works without any problems. The current version on my phone is built today for testing.

I have no idea, what happened since last successful build.

Now rolled back everything to that day, when the last build succeeded. The build failed, but got another error message.

Attempting to set app name
Setting App Name:  T枚r枚kb谩lint Ma
ANDROID_HOME=/usr/local/src/android-sdk-linux
JAVA_HOME=/usr/lib/jvm/java-8-oracle
Subproject Path: CordovaLib
Incremental java compilation is an incubating feature.
Preparing "Install Android Support Repository".
Warning: Failed to read or create install properties file.

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'android'.
> Failed to install the following SDK components:
  [Android Support Repository]
  The SDK directory (/usr/local/src/android-sdk-linux) is not writeable,
  please update the directory permissions.

* 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.147 secs
Error: /home/package/workspace/apps-54624e0c-184/cordova/platforms/android/gradlew: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'android'.
> Failed to install the following SDK components:
  [Android Support Repository]
  The SDK directory (/usr/local/src/android-sdk-linux) is not writeable,
  please update the directory permissions.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

The SDK directory (/usr/local/src/android-sdk-linux) is not writeable,

I believe that there was another success build on that machine, but the bug is really at my side?

Hm. Now the build has succeeded.

The only one thing what I did is:

ionic cordova plugin rm cordova-plugin-screen-orientation

Tried locally everything from zero, and when I hit ionic cordova prepare android it always failed when tried installing the screen orientation plugin.

Maybe this is connected with previous errors, maybe not, but now the cloud build works again.

@djereg We fixed this on our end for the time-being. It exposed a larger issue with what cordova-android is doing going forward, but for now it should work again.

Thanks!

Build Date: 2017-09-04 13:51:44 +0000

PLUGIN OUTPUT

Fetching plugin "[email protected]" via npm
Installing "cordova-plugin-crosswalk-webview" at "1.8.0" for android
Fetching plugin "[email protected]" via npm

Installing "cordova-plugin-legacy-whitelist" at "1.1.1" for android

COMPILE OUTPUT

Configuration on demand is an incubating feature.
null
org.xwalk:xwalk_core_library:19+

FAILURE: Build failed with an exception.

BUILD FAILED

Total time: 2.634 secs
undefined

same problem here, please help me

@dwieeb - Can you please explain how you fixed it on your end https://github.com/ionic-team/ionic-cli/issues/2381#issuecomment-306876936 and what the root cause of the issue was? Thanks.

@davidquon The error "A problem occurred configuring root project 'android'." can manifest itself in hundreds of ways. Only seeing a full stack trace can help identify what the issue is.

@dwieeb still i could not solved this issue can you give the proper solution for this. even am update the android studio also..

@sudharsan17 As I just explained, this is a very general error. There could be hundreds of reasons one might get this error. Please post the full output of the command.

I got same error when i tried to install the plugin, cordova-plugin-x-socialsharing.
ionic cordova plugin add cordova-plugin-x-socialsharing

> cordova plugin add cordova-plugin-x-socialsharing --save
Installing "cordova-plugin-x-socialsharing" for android

Plugin dependency "[email protected]" already fetched, using that version.

Installing "es6-promise-plugin" for android
ANDROID_HOME=/Users/XXXX/Library/Android/sdk
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home
Subproject Path: CordovaLib
null

org.xwalk:xwalk_core_library:22+
Incremental java compilation is an incubating feature.


FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'android'.
> 
Could not resolve all dependencies for configuration ':_armv7DebugApkCopy'.
   > Could not find com.android.support:support-v4:27.0.1.
     Required by:
         :android:unspecified > org.xwalk:xwalk_core_library:22.52.561.4

   > Could not find com.android.support:support-v4:27.0.1.
     Required by:
         :android:unspecified > com.google.firebase:firebase-crash:10.2.4 > com.google.android.gms:play-services-basement:10.2.4
   > Could not find com.android.support:support-annotations:27.0.1.
     Required by:
         :android:unspecified > com.facebook.android:facebook-android-sdk:4.29.0 > com.facebook.android:facebook-core:4.29.0
   > Could not find com.android.support:support-core-utils:27.0.1.
     Required by:
         :android:unspecified > com.facebook.android:facebook-android-sdk:4.29.0 > com.facebook.android:facebook-core:4.29.0
   > 
Could not find com.android.support:appcompat-v7:27.0.1.
     Required by:
         :android:unspecified > com.facebook.android:facebook-android-sdk:4.29.0 > com.facebook.android:facebook-common:4.29.0

   > Could not find com.android.support:cardview-v7:27.0.1.

     Required by:

         :android:unspecified > com.facebook.android:facebook-android-sdk:4.29.0 > com.facebook.android:facebook-common:4.29.0
   > Could not find com.android.support:customtabs:27.0.1.

     Required by:
         :android:unspecified > com.facebook.android:facebook-android-sdk:4.29.0 > com.facebook.android:facebook-common:4.29.0
   > Could not find com.android.support:support-v4:27.0.1.
     Required by:
         :android:unspecified > com.facebook.android:facebook-android-sdk:4.29.0 > com.facebook.android:facebook-common:4.29.0

* 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: 13.846 secs
Failed to install 'es6-promise-plugin': Error: /Users/XXXX/Workspace/main/Ionic-v2-Firebase/platforms/android/gradlew: Command failed with exit code 1
    at ChildProcess.whenDone (/Users/XXXX/Workspace/main/Ionic-v2-Firebase/platforms/android/cordova/node_modules/cordova-common/src/superspawn.js:169:23)
    at emitTwo (events.js:125:13)
    at ChildProcess.emit (events.js:213:7)
    at maybeClose (internal/child_process.js:927:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)

Failed to install 'cordova-plugin-x-socialsharing': Error: /Users/XXXX/Workspace/main/Ionic-v2-Firebase/platforms/android/gradlew: Command failed with exit code 1
    at ChildProcess.whenDone (/Users/XXXX/Workspace/main/Ionic-v2-Firebase/platforms/android/cordova/node_modules/cordova-common/src/superspawn.js:169:23)
    at emitTwo (events.js:125:13)
    at ChildProcess.emit (events.js:213:7)
    at maybeClose (internal/child_process.js:927:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)

Error: /Users/XXXX/Workspace/main/Ionic-v2-Firebase/platforms/android/gradlew: Command failed with exit code 1

[ERROR] An error occurred while running cordova plugin add 
        cordova-plugin-x-socialsharing --save (exit code 1).

cordova platform list

Installed platforms:
android 6.1.0
ios 4.4.0

ionic version

3.19.0

Can anyone help me?

I solved the issue by updating android platform version.
ionic cordova platform update android

Installed platforms:
  android 6.2.3
  ios 4.4.0

I have the same problem , if I create an ionic tabs app it works but if i select the ionic conference app it fails..

Any solution ?

````

cordova build android --release
ANDROID_HOME=/Users/davidgarcia/Library/Android/sdk
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home
Subproject Path: CordovaLib
[11:34:03] lint finished in 1.94 s
null

The Task.leftShift(Closure) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use Task.doLast(Action) instead.

    at build_314ud82om9enqy7dipurf1024.run(/Users/davidgarcia/Desktop/ionic/reservas/platforms/android/build.gradle:142)

org.xwalk:xwalk_core_library:22+

Configuration 'compile' in project ':' is deprecated. Use 'implementation' instead.

FAILURE:
Build failed with an exception.

  • What went wrong:

A problem occurred configuring root project 'android'.

>
All flavors must now belong to a named flavor dimension. Learn more at https://d.android.com/r/tools/flavorDimensions-missing-error-message.html

  • Try:

Run with
--stacktrace
option to get the stack trace. Run with
--info
or
--debug
option to get more log output.

BUILD FAILED in 1s
(node:2346) UnhandledPromiseRejectionWarning: Error: /Users/davidgarcia/Desktop/ionic/reservas/platforms/android/gradlew: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.

BUILD FAILED in 1s
at ChildProcess.whenDone (/Users/davidgarcia/Desktop/ionic/reservas/platforms/android/cordova/node_modules/cordova-common/src/superspawn.js:169:23)
at emitTwo (events.js:126:13)
at ChildProcess.emit (events.js:214:7)
at maybeClose (internal/child_process.js:925:16)
at Socket.stream.socket.on (internal/child_process.js:346:11)
at emitOne (events.js:116:13)
at Socket.emit (events.js:211:7)
at Pipe._handle.close [as _onclose] (net.js:567:12)
(node:2346) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:2346) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are nothandled will terminate the Node.js process with a non-zero exit code.

@pookdeveloper Going to answer you in your issue: https://github.com/ionic-team/ionic-cli/issues/3123

For newcomers to this issue:

Searching Google for A problem occurred configuring root project 'android'. brings you to this issue, but it's just a message that's telling you that an issue occurred. The actual error is right below it, which you should Google instead. If you don't see an existing topic or issue, create a new one. Thanks!

Was this page helpful?
0 / 5 - 0 ratings