When I Run: cordova build, I got this:
Running command:/Users/tyrant/workspace/ideaProject/hello/platforms/android/cordova/build
ANDROID_HOME=/Users/tyrant/s
This is because you have already downloaded a corrupt version of the Gradle package in your system directory. (Maybe due to internet connection issues?) Just go to your local path below and remove all contents inside it.
/Users/tyrant/.gradle/wrapper/dists/gradle-2.2.1-all/2m8005s69iu8v0oiejfej094b/
Run cordova build
again. This will fix your issue for sure.
For anyone facing this problem when first building a react-native Android app, it's likely to be the gradle-2.4 file, which is generally found in:
/var/root/.gradle/wrapper/dists/gradle-2.4-all/<some_string>/gradle-2.4
Just manually delete the zip file, download a new copy and replace.
Check whether you are having download limit and, if so, download the gradle zip file manually, place it in folder such as /Users/tyrant/.gradle/wrapper/dists/gradle-2.2.1-all/2m8005s69iu8v0oiejfej094b/ and run the command.
I read a lot of this problem, and i found 2 solutions, the 1st one is to remove all contents inside it (as the last post said) but it doesn't work for all, in my case don`t.
The other solution is to put in a local folder of the project the zip file and change the path, and that is not a real solution, cause the size is 50 mb...
So the easiest way i found is just download the right zip from the Gradle site--> https://services.gradle.org/distributions and just replace it in your computer manually... and this works instantly for me.