Task 'wrapper' not found in root project 'android'

getting this now


✖ 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
3 Likes

I am also facing same issue, please somebody help

Post your ionic info and cordova platform list please.

platform list : Installed platforms:
android 6.2.2
browser 4.1.0
Available platforms:
amazon-fireos ~3.6.3 (deprecated)
blackberry10 ~3.8.0
firefoxos ~3.6.3
ubuntu ~4.3.4
webos ~3.7.0

ionic info
Cordova CLI: 6.5.0
Ionic Framework Version: 3.0.1
Ionic CLI Version: 2.2.1
Ionic App Lib Version: 2.2.0
Ionic App Scripts Version: 1.3.0
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Linux 3.19
Node Version: v6.9.4
Xcode version: Not instal

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.

U also must set variable $PATH, $ANDROID_HOME, $JAVA_HOME

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.

ohh sorry I forgot and thanks man

Hi all,
Same error, anyone knows how to fix it

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?

check once by updating gradle

I am also facing this issue with the following configuration:

  • ionic info:
global packages:

    @ionic/cli-utils : 1.0.0-rc.2
    Cordova CLI      : 7.0.1
    Ionic CLI        : 3.0.0-rc.2

local packages:

    @ionic/app-scripts              : 1.3.7
    @ionic/cli-plugin-cordova       : 1.0.0
    @ionic/cli-plugin-ionic-angular : 1.0.0
    Ionic Framework                 : ionic-angular 3.2.1

System:

    Node       : v7.10.0
    OS         : Linux 3.19
    Xcode      : not installed
    ios-deploy : not installed
    ios-sim    : not installed
  • cordova -v:
7.0.1
  • ionic cordova platform list:
✔ running command: cordova platform list - done!
{}
Installed platforms:
  android 6.2.3
Available platforms: 
  blackberry10 ~3.8.0 (deprecated)
  browser ~4.1.0
  ubuntu ~4.3.4 (deprecated)
  webos ~3.7.0
  • cordova requirements:
Requirements check results for android:
Java JDK: installed 1.8.0
Android SDK: installed true
Android target: installed Google Inc.:Google APIs:23,Google Inc.:Google APIs:19,Google Inc.:Google APIs:16,android-25,android-24,android-23,android-19,android-16
Gradle: installed /usr/share/gradle/bin/gradle

You should upgrade your CLI and cli-utils to final versions.
Also, please post your complete error message. Sometimes there are subtle differences.

Here, i’am facing the same problem issuing ionic build android:
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

Previously required info:

ionic info

Your system information:

Cordova CLI: 7.0.1
Ionic CLI Version: 2.2.3
Ionic App Lib Version: 2.2.1
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Linux 3.2
Node Version: v4.8.3
Xcode version: Not installed

cordova -v

7.0.1

ionic platform list

Installed platforms:
android 6.2.3
Available platforms:
blackberry10 ~3.8.0 (deprecated)
browser ~4.1.0
ubuntu ~4.3.4 (deprecated)
webos ~3.7.0

cordova requirements

Requirements check results for android:
Java JDK: installed 1.8.0
Android SDK: installed true
Android target: installed android-25
Gradle: installed /usr/share/gradle/bin/gradle

Anybody could help, please?

PFA below

Now its opening in app but the above error I am getting now and below is my ionic details

global packages:

    @ionic/cli-utils : 1.0.0-rc.2
    Cordova CLI      : 6.5.0 
    Ionic CLI        : 3.0.0-rc.2

local packages:

    @ionic/app-scripts              : 1.3.7
    @ionic/cli-plugin-cordova       : 1.0.0-rc.2
    @ionic/cli-plugin-ionic-angular : 1.0.0-rc.2
    Ionic Framework                 : ionic-angular 3.1.1

System:

    Node       : v6.10.2
    OS         : Linux 4.4
    Xcode      : not installed
    ios-deploy : not installed
    ios-sim    : not 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

You should defintely upgrade to final versions of everything, too. No -rc.2 - otherwise debugging makes no sense.

I think this is all more a problem with Cordova and Android SDK, but I created a Ionic CLI Github issue anyway:

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:

Can anyone try that?

I tried and it is now saying:

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