简体   繁体   中英

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.

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

我在android-studio-path / gradle / bin中找到了gradle可执行文件,并将其包含在我的$ PATH中。

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM