ionic2 android build error

て烟熏妆下的殇ゞ 提交于 2020-01-24 13:07:25

问题


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.

回答1:


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




回答2:


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




回答3:


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




回答4:


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



来源:https://stackoverflow.com/questions/43863744/ionic2-android-build-error

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!