Nilanga Saluwadana
Nilanga Saluwadana

Reputation: 744

ionic2 android build error

When I try to run ionic 2 application

ionic run android

It stops leaving an error as below. Please help me to fix this problem

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: 1.435 secs

Error: /usr/share/gradle/bin/gradle: Command failed with exit code 1

My ionic info is

    Cordova CLI: 7.0.0 
Ionic Framework Version: 3.1.1
Ionic CLI Version: 2.2.3
Ionic App Lib Version: 2.2.1
Ionic App Scripts Version: 1.3.7
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Linux 4.2
Node Version: v7.4.0
Xcode version: Not installed

Platform list is

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.

Upvotes: 2

Views: 2239

Answers (4)

Striker
Striker

Reputation: 958

Go to the site https://gradle.org/releases, download the lastest version in some folder. Unpack the zipfolder and create a symbolic link: sudo ln -sf /PATH-TO-BIN-FOLDER/gradle /usr/bin/gradle

Upvotes: 1

Willian Will
Willian Will

Reputation: 1

are you using Jessie Debian or ubuntu this will be right,

  1. go to https://gradle.org/install and download the version 4.0 of gradle,

  2. mkdir opt/gradle

  3. unzip -d /opt/gradle gradle-4.0-bin.zip

  4. /* I using Debian Jessie then I do :

    if [ -d "/opt/gradle/gradle-4.0" ]; then
        export GRADLE_HOME="/opt/gradle/gradle-4.0"
        PATH="$PATH:$GRADLE_HOME/bin"
    fi
    
  5. open another terminal and type gradle -v

  6. return to cordova project and type cordova build

Upvotes: 0

Julius Š.
Julius Š.

Reputation: 174

I found the gradle executable in android-studio-path/gradle/bin and included it to my $PATH.

Upvotes: 1

Nilanga Saluwadana
Nilanga Saluwadana

Reputation: 744

Just figured out the problems,

I just remove Gradle and run below code

sudo apt-get remove gradle

And ran

ionic run android

Its install Gradle itself, The problem was solved

Upvotes: 3

Related Questions