✖ running command: cordova build android - failed!
[ERROR] Cordova encountered an error.
You may get more insight by running the Cordova command above directly.
[ERROR] An error occurred while running cordova build android (exit code 1):
ANDROID_HOME=/home/nikhil/android-sdk
JAVA_HOME=/usr/lib/jvm/java-8-oracle
FAILURE: Could not determine which tasks to execute.
* What went wrong:
Task 'wrapper' not found in root project 'android'.
* Try:
Run gradle tasks to get a list of available tasks.
BUILD FAILED
Total time: 3.826 secs
Error: /usr/share/gradle/bin/gradle: Command failed with exit code 1
nikhil@nikhiltvisha:/var/www/html/ionic/myApp$ sudo cordova build android
ANDROID_HOME=/home/nikhil/android-sdk
JAVA_HOME=/usr/lib/jvm/java-8-oracle
FAILURE: Could not determine which tasks to execute.
* What went wrong:
Task 'wrapper' not found in root project 'android'.
* Try:
Run gradle tasks to get a list of available tasks.
BUILD FAILED
Total time: 2.063 secs
Error: /usr/share/gradle/bin/gradle: Command failed with exit code 1
There should be a “6.2.3” of cordova android available, try cordova platform update android@6.2.3 and see if this fixes stuff. You should also update your Ionic CLI to 2.2.3 by the way.
I changed your post to format your code or error message correctly. Please use the </> button above the post input field to format your code or error message or wrap it in ``` (“code fences”) manually. This will make sure your text is readable and if it recognizes the programming language it also automatically adds code syntax highlighting. Thanks.
Did you try what I posted?
What is your Ionic CLI (ionic info), Cordova (cordova -v) and cordova-android (ionic platform list) version and Android SDK (cordova requirements) installed?
The error is still thrown after updating Ionic CLI to 3.0.0 and @ionic/cli-utils to 1.0.0. The error message is:
ionic cordova run android
Running app-scripts build: --address 0.0.0.0 --port 8100 --p 8100 --livereload-port 35729 --r 35729 --iscordovaserve --externalIpRequired --nobrowser
[08:43:51] build dev started ...
[08:43:51] clean started ...
[08:43:51] clean finished in 5 ms
[08:43:51] copy started ...
[08:43:51] transpile started ...
[08:43:54] transpile finished in 3.91 s
[08:43:54] preprocess started ...
[08:43:54] deeplinks started ...
[08:43:55] deeplinks finished in 153 ms
[08:43:55] preprocess finished in 153 ms
[08:43:55] webpack started ...
[08:43:55] copy finished in 4.20 s
[08:44:09] webpack finished in 14.06 s
[08:44:09] sass started ...
[08:44:10] sass finished in 862 ms
[08:44:10] postprocess started ...
[08:44:10] postprocess finished in 4 ms
[08:44:10] lint started ...
[08:44:10] build dev finished in 19.05 s
> cordova run android
ANDROID_HOME=/usr/local/android/android-sdk-linux
JAVA_HOME=/usr/local/java/jdk1.8.0_91
FAILURE: Could not determine which tasks to execute.
* What went wrong:
Task 'wrapper' not found in root project 'android'.
* Try:
Run gradle tasks
to get a list of available tasks.
BUILD FAILED
Total time: 2.2 secs
Error: /usr/share/gradle/bin/gradle: Command failed with exit code 1
[ERROR] Cordova encountered an error.
You may get more insight by running the Cordova command above directly.
[ERROR] An error occurred while running cordova run android (exit code 1).
[1] 9549 exit 1 ionic cordova run android
Here someone had a similar problem and solved it by removing the installed gradle version, which then automatically installed it again but in a working version:
ionic cordova run android
Running app-scripts build: --address 0.0.0.0 --port 8100 --p 8100 --livereload-port 35729 --r 35729 --iscordovaserve --externalIpRequired --nobrowser
[10:13:57] build dev started ...
[10:13:57] clean started ...
[10:13:57] clean finished in 3 ms
[10:13:57] copy started ...
[10:13:57] transpile started ...
[10:14:01] transpile finished in 3.98 s
[10:14:01] preprocess started ...
[10:14:01] deeplinks started ...
[10:14:01] deeplinks finished in 191 ms
[10:14:01] preprocess finished in 193 ms
[10:14:01] webpack started ...
[10:14:01] copy finished in 4.32 s
[10:14:17] webpack finished in 15.48 s
[10:14:17] sass started ...
[10:14:18] sass finished in 907 ms
[10:14:18] postprocess started ...
[10:14:18] postprocess finished in 13 ms
[10:14:18] lint started ...
[10:14:18] build dev finished in 20.64 s
> cordova run android
ANDROID_HOME=/usr/local/android/android-sdk-linux
JAVA_HOME=/usr/local/java/jdk1.8.0_91
Error: Could not find an installed version of Gradle either in Android Studio,
or on your system to install the gradle wrapper. Please include gradle
in your path, or install Android Studio
[ERROR] Cordova encountered an error.
You may get more insight by running the Cordova command above directly.
[ERROR] An error occurred while running cordova run android (exit code 1).
[1] 20364 exit 1 ionic cordova run android