Aqil Hex Aqil Hex - 4 months ago 59
Android Question

gradle error while try to build app using cordova

I'm using Ubuntu, and I installed Cordova successfully on my system, now im trying to build app using this command:

$ cordova build android


Before the current error, I encountered:


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


Then i tried:

$ sudo apt install gradle


It has been installed successfully

And then I'm struggling with this one:

aqil@dell:~/hello$ cordova build

ANDROID_HOME=/home/aqil/Android/Sdk
JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
/usr/lib/jvm/java-8-openjdk-amd64/bin/java: symbol lookup error: /usr/lib/jni/libnative-platform-curses.so: undefined symbol: tgetent
Error: /usr/share/gradle/bin/gradle: Command failed with exit code 127


Can anyone please help me?

Answer Source

i finally could find the problem,and it was something wrong with my gradle,i first removed it with:

$ sudo apt remove gradle

because i downloaded it from the terminal,but then i downloaded it manually from the link below

gradle-3.5.zip

unpacked it in somewhere,and inlcuded its path in my environment using this code:

$ sudo gedit ~/.bashrc

at the bottom of this page,i defined the path of gradle by this code:

export  GRADLE_HOME=/home/aqil/Android/gradle-3.5
export PATH=$PATH:$GRADLE_HOME/bin

then i tried building but i encountered an error:

BUILD FAILED

Total time: 9 mins 33.837 secs Error: /home/aqil/App/platforms/android/gradlew: Command failed with exit code 1 Error output: FAILURE: Build failed with an exception.

What went wrong: A problem occurred configuring root project 'android'. Could not resolve all dependencies for configuration ':_debugApk'. A problem occurred configuring project ':CordovaLib'. Could not resolve all dependencies for configuration ':CordovaLib:classpath'. Could not resolve com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3. Required by: project :CordovaLib Could not resolve com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3. Could not get resource 'https://jcenter.bintray.com/com/jfrog/bintray/gradle/gradle-bintray-plugin/1.7.3/gradle-bintray-plugin-1.7.3.pom'. Could not GET 'https://jcenter.bintray.com/com/jfrog/bintray/gradle/gradle-bintray-plugin/1.7.3/gradle-bintray-plugin-1.7.3.pom'. Connect to jcenter.bintray.com:443 [jcenter.bintray.com/108.168.243.150] failed: Connection timed out (Connection timed out) Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

and i belived its connection problem,so i used tor proxy and then its worked for me,try it both with tor proxy and none,it should works for you too.