Android SDK config issue on IntelliJ - android

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

Related

JDK version error when building android app cordova

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

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.

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)

How to build android project with openjdk on Ubuntu?

I found this Is Sun Java really necessary for using Android SDK on Ubuntu 10.10? I prefer OpenJDK but I can't build android project on Ubuntu. When I try:
$ ant debug
I got:
Unable to locate tools.jar. Expected to find it in /usr/lib/jvm/java-6-openjdk/lib/tools.jar
...
BUILD FAILED
/home/kuba/projects/Android/android-sdk-linux/tools/ant/build.xml:651: The following error occurred while executing this line:
/home/kuba/projects/Android/android-sdk-linux/tools/ant/build.xml:672: Unable to find a javac compiler;
com.sun.tools.javac.Main is not on the classpath.
Perhaps JAVA_HOME does not point to the JDK.
It is currently set to "/usr/lib/jvm/java-6-openjdk/jre"
I have java version:
$ java -version
java version "1.6.0_20"
OpenJDK Runtime Environment (IcedTea6 1.9.13) (6b20-1.9.13-0ubuntu1~10.10.1)
OpenJDK Client VM (build 19.0-b09, mixed mode, sharing)
Make sure you have the openjdk JDK installed. By default you probably only have the JRE installed. If you open Synaptic, search for openjdk and then you'll see both the JDK and the JRE. Select the JDK package and install. I think the actual packagename is openjdk-6-jdk.
or use the commandline
# sudo apt-get install openjdk-6-jdk
Android's official webpage reccomends the use of the official JDK from Sun/Oracle that you can download at http://www.oracle.com/technetwork/java/javase/downloads/index.html , the use of OpenJDK is unsupported and highly unrecommended.
You don't need to install the official JDK in your system, if this is what you are worring about, just download the *.bin version of the JDK of your choice ( i suggest the 1.6 version ), unpack everything by executing the *.bin in a terminal, and just modify 2 environment variable like this:
PATH , add the path to the jdk executables path_to_jdk/bin/ to your PATH
JAVA_HOME , set JAVA_HOME to the generic path of your jdk, NOT the bin or lib path, just as before without bin, only path_to_jdk/
you can modify this variables by editing the /etc/bash.bashrc or your local .bashrc, I suggest to edit the one under /etc
you also want to remove your actual OpenJDK from your system.
I've fixed same error (in Debian/Ubuntu) by installing gcj-jdk.
Before installing this package i had java-7-openjdk, but no tools.jar inside its directory.
After installing gcj-jdk I've located tools.jar and made a symlink to it inside directory where ant wants it to be.

I can't install the ADT plugin for eclipse 3.5.2 on windows XP(32bit)

I had installed jdk,sdk,eclipse,and set the path.i will show the jdk-version,sdk.
jdk version test:
C:>java -version
java version "1.6.0_10"
Java(TM) SE Runtime Environment (build 1.6.0_10-b33)
Java HotSpot(TM) Client VM (build 11.0-b15, mixed mode, sharing)
sdk test:
C:>android -help
Usage: java [-options] class [args...]
(to execute a class)
or java [-options] -jar jarfile [args...]
(to execute a jar file)
where options include:
-client to select the "client" VM -server to select the "server" VM
-hotspot is a synonym for the "client" VM [deprecated]
The default VM is client.
-cp <class search path of directories and zip/jar files>
-classpath <class search path of directories and zip/jar files>
the eclipse version:
Eclipse IDE for Java Developers---Eclipse Galileo SR2 Packages (v 3.5.2)
but have a question when i install the ADT: i install it online,the url
the question is :
you are installing software that contains unsigned content.The authenticity or validity of this software cannot be established.
Just accept it and allow it to install.

Categories

Resources