JDK version error when building android app cordova - android

Im trying to convert angular appliacation to an apk using cordova. When running
cordova build android
I get the following error
Checking Java JDK and Android SDK versions
ANDROID_SDK_ROOT=/home/mohit/Android/Sdk (recommended setting)
ANDROID_HOME=/home/mohit/Android/Sdk (DEPRECATED)
Requirements check failed for JDK 8 ('1.8.*')! Detected version: 11.0.7
Check your ANDROID_SDK_ROOT / JAVA_HOME / PATH environment variables.
Running command:
java --version
openjdk 11.0.7 2020-04-14
OpenJDK Runtime Environment (build 11.0.7+10-post-Ubuntu-2ubuntu218.04)
OpenJDK 64-Bit Server VM (build 11.0.7+10-post-Ubuntu-2ubuntu218.04, mixed mode, sharing)
sudo update-alternatives --set java /usr/lib/jvm/jdk1.8.0_version/bin/java
update-alternatives: error: alternative /usr/lib/jvm/jdk1.8.0_version/bin/java for java not registered; not setting

It's because you use OpenJDK where cordova requires Oracle JavaJDK. Version numbers do not match. Install Oracle JDK.
https://docs.oracle.com/javase/8/docs/technotes/guides/install/mac_jdk.html

Related

configuration jdk in android studio with ubuntu 17.10 not found java home

When I open Android studio, I am getting the following error:
java_home not found
My configuration :
Android Studio 3.0
Ubuntu 17.10 Gnome
java version "1.8.0_152"
Java(TM) SE Runtime Environment (build 1.8.0_152-b16)
Java HotSpot(TM) 64-Bit Server VM (build 25.152-b16, mixed mode)
I ran: sudo apt-get install oracle-java8-set-default
(and installed to /usr/lib/jvm/jdk1.8.0/)
I edited "/etc/environment" and set JAVA_HOME="/usr/lib/jvm/jdk1.8.0/"
And added the following lines to "/home/faiberts/.bashrc" and "/root/.bashrc":
export JAVA_HOME="/usr/lib/jvm/jdk1.8.0/"
export PATH=$JAVA_HOME/bin:$PATH"
Do I have some error in some step or it is necessary to change some configuration because I am confused since this is my first time trying to do development in android.
Thank you in advance for your valuable help.

Meteor run android CordovaError: Requirements check failed

I get this error while running in Android using meteor run android:
[CordovaError: Requirements check failed for JDK 1.8 or greater]
name: 'CordovaError',
message: 'Requirements check failed for JDK 1.8 or greater'
I'm using Ubuntu 14.04 LTS 32bit, Meteor 1.5.2.1
$ java --version
java version "1.8.0_144"
Java(TM) SE Runtime Environment (build 1.8.0_144-b01)
Java HotSpot(TM) Server VM (build 25.144-b01, mixed mode)

Android SDK config issue on IntelliJ

I'm trying to set the SDK to my project on IntelliJ and when I select the path to the SDK I get this error.
I'm using IntelliJ-IDEA as IDE
Apache Maven 3.0.5 (r01de14724cdef164cd33c7c8c2fe155faf9602da; 2013-02-19 10:51:28-0300)
Maven home: /usr/local/apache-maven-3.0.5
Java version: 1.7.0_80, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-7-oracle/jre
Default locale: es_CL, platform encoding: UTF-8
OS name: "linux", version: "4.4.0-21-generic", arch: "amd64", family: "unix"
java -version
java version "1.7.0_80"
Java(TM) SE Runtime Environment (build 1.7.0_80-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.80-b11, mixed mode)
javac -version
javac 1.7.0_80
echo $JAVA_HOME
/usr/lib/jvm/java-7-oracle
Any help?
You need to install the Java SE Development Kit (JDK) on your computer in order to compile Java programs (and by extension, Android apps). You can download and install the JDK from the Oracle website.
Alternatively, if you're using a Debian-based linux distro (like Ubuntu), you can use OpenJDK:
sudo apt-get install openjdk-7-jdk
You need to define path for JDK in File -> Project Structure -> SDK Location -> JDK Location. Use this picture as a reference.
For your info, JDK stands for Java Development Kit and can be downloaded from Download JDK

ionic build android : Error :Failed to run “java -version ”

windows 10
ionic 1.7.15
please help me
ionic build android
java version "1.8.0_91"
Java(TM) SE Runtime Environment (build 1.8.0_91-b15)
Java HotSpot(TM) Client VM (build 25.91-b15, mixed mode, sharing)
Error: Failed to run "java -version", make sure that you have a JDK installed.
You can get it from: http://www.oracle.com/technetwork/java/javase/downloads.
Your JAVA_HOME is invalid: C:\Program Files (x86)\Java\jre1.8.0_91
JAVA_HOME environment variable should be set to java jdk installation path folder not jre installation path. As per your error trace, your java home is set to jre path which could be the issue

build cordova with command line in cygwin

I am using cygwin to build the cordova android project.
I created a project successfully
but there is some errors when I build it:
╭─Dozer#Dozer-PC ~/Projects/ba-crm/crm-plus ‹master*›
╰─$ cordova build 127 ↵
Running command: cmd args=["/c","C:\\cygwin64\\home\\Dozer\\Projects\\ba-crm\\crm-plus\\platforms\\android\\cordova\\build"]
ANT_HOME is set incorrectly or ant could not be located. Please set ANT_HOME.
But I have already install all the libraries in cygwin:
╭─Dozer#Dozer-PC ~/Projects/ba-crm/crm-plus ‹master*›
╰─$ ant -version
Apache Ant(TM) version 1.9.3 compiled on December 23 2013
╭─Dozer#Dozer-PC ~/Projects/ba-crm/crm-plus ‹master*›
╰─$ java -version
java version "1.7.0_51"
Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode)
╭─Dozer#Dozer-PC ~/Projects/ba-crm/crm-plus ‹master*›
╰─$ cordova -version
3.4.0-0.1.3
Just because the library is installed does not necessarily mean that the environment variable is set. To see if it's set, in Cygwin I believe you can do echo "$ANT_HOME".
Additionally as the error says, make sure it's set correctly. For example, on my machine ANT_HOME points to C:\Source\ANT\apache-ant-1.8.4.
Lastly, make sure your path is set up to have %ANT_HOME%\bin
export ANT_HOME=c:/path/apache-ant-1.9.4
(export ANT_HOME/cygdrive/c/path/apache-ant-1.9.4 fails - you need the :/ style)

Categories

Resources