Error:compileSdkVersion android-21 requires compiling with JDK 7 - windows - android

Android studio -
updated sdk with android 21 , updated java to 1.7.0 . Whenever i try to compile with android L ( 21 ) , it throws this error and gradle sync is failed.
C:\Users\me>java -version
java version "1.7.0_71"
Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode)
found similar question for mac -
Android Studio needs JDK 7 for Android-L mac

You have two options, you can just switch your compiled version back to 20 if you do not want all the goodness of SDK 21. To upgrade to JDK 7 for Windows, do this:
Download the Jave 7 exe from
http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html
Perform a straight forward install and take note of the installation folder such as C:\Program Files\Java\jdk1.7.0_71
Then click on File > Project Structure and point the JDK location to
the location of the JDK you just installed

Related

Which JDK version is the latest supported by Android Studio?

I am trying to install Android Studio on Ubuntu 18.04.
I downloaded and extracted Android Studio 3.1, and was wondering which JDK version is the last supported by Android Studio.
According to Oracle JDK page, JDK 8 has reached EOL:
Oracle will not post further updates of Java SE 8 to its public download sites for commercial use after January 2019. Customers who need continued access to critical bug fixes and security fixes as well as general maintenance for Java SE 8 or previous versions can get long term support through Oracle Java SE Subscription or Oracle Java SE Desktop Subscription. For more information, and details on how to receive longer term support for Oracle JDK 8, please see the Oracle Java SE Support Roadmap.
I installed Oracle JDK 11.0.1 for my Android studio as it is latest, but it throws the error:
Error: Could not find or load main class com.intellij.idea.Main
Caused by: java.lang.ClassNotFoundException: com.intellij.idea.Main
When starting android studio.
java -version
Gives Output:
java version "11.0.1" 2018-10-16 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.1+13-LTS)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.1+13-LTS, mixed mode)
And
echo $JAVA_HOME
Gives Output
/usr/lib/jvm/jdk-11.0.1
Which JDK version should I use?
You should use the JDK version bundled with Android Studio; you don't need a separate JDK installation. The bundled JDK version is currently based on OpenJDK 8, but it's actively maintained by JetBrains, which backports security fixes and other improvements to that version.

Can't configure Android SDK in ADT

I'm trying to setup Android SDK on Eclipse ADT but I can't since I'm getting a error saying that Android SDK is outdated when is not. Since one image is better than millions of words take a look at images below:
SDK Manager: showing Android latest SDK installed
Eclipse ADT: finding for the SDK path and notice how ADT doesn't allow me to apply them
What is wrong here? Why ADT doesn't find any on that folder?
Swtich from ADT to Android Development Studio
As suggested from one member here I switched from ADT to ADS but I can't open the IDE since I got this error all the time:
Error launching Android Studio The environment variable JAVA_HOME
(with the value of c:\Program Files\Java\jre7\lib) does not point to
a valid JVM installation.
In terminal I run the command java -version and I get this as output:
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)
What is the right path to configure the JVM? Do I miss to install anything else?
I think you will have a better time if you just skip Eclipse and go strait to Android Studio.
https://developer.android.com/sdk/installing/studio.html
You need to update ADT plugin. Set repo URL https://dl-ssl.google.com/android/eclipse/ and click "Install New Software" . See https://stackoverflow.com/a/16589558/192373.

Can't open the SDK Manager

I am new to Android Development, ive just downloaded the SDK (The ADT Bundle Containing eclipse and the sdk), installed JDK 1.6 buth when i try to launch the SDK Manager nothing happens. If i run the file ./tools/android.bat no error occurs. I cant get it to run.
CMD Output
C:\Users\<user_name>>java -version
java version "1.6.0_45"
Java(TM) SE Runtime Environment (build 1.6.0_45-b06)
Java HotSpot(TM) 64-Bit Server VM (build 20.45-b01, mixed mode)
C:\Users\<user_name>>javac -version
javac 1.6.0_45
AVD Runs but not the SDK Manager
Open it As Run AS Administrator it will work..
Just confirm the JDK version installed is a x64 version.
Refer this Android SDK and AVD Manager will not run.

Android Development Tools on Mac OS X

I am trying to install the ADT plugin on Eclipse, but it doesn't seem to be working. I tried using the ADT Bundle for Mac but I always get the error
dyld: unknown required load command 0x80000022
on the console. I tried both Eclipse Juno and Eclipse Indigo using the eclipse ADT plugin, it downloaded and installed the latter, but when I go in the Preferences, there is no 'Android' there... I'm using an iMac using Mac OS X v.10.5.8 (Leopard).
because something in the bundle is made specifically for a mac 10.6 and it isn't backwards compatible.
I'm having the same issue.
and here's my java
Device-873EF9:~ Tahj182$ java -version
java version "1.5.0_30"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_30-b03-389-9M3425)
Java HotSpot(TM) Client VM (build 1.5.0_30-161, mixed mode, sharing)
Device-873EF9:~ Tahj182$
Find out which Java version you have, it may be that your plugin requires a Java version.
Terminal:
$java -version

Android SDK says I don't have a JDK, don't I?

I keep getting the message that I should have the JDK installed to be able to install Android SDK, it says a JRE is not enough. The thing is that I have a JDK. These are my environment variables:
CLASSPATH: C:\Program Files\Java\jdk1.7.0\lib
JAVA_HOME: C:\Program Files\Java\jdk1.7.0
JRE_HOME: C:\Program Files\Java\jdk1.7.0\jre
PATH: C:\Program Files\Java\jdk1.7.0\bin
although to my surprise, cmd shows this:
C:\Users\Thiago>java -version
java version "1.7.0"
Java(TM) SE Runtime Environment (build 1.7.0-b147)
Java HotSpot(TM) Client VM (build 21.0-b17, mixed mode, sharing)
what's going on?
try to install all 32 bit softwares only. It solved my problem.
Android SDK itself is 32 bit and it identifies only 32 bit JDK. So install following softwares.
JDK (32 bit)
Android SDK (while installing SDK, make sure install it in directory other than "C:\Program Files (x86)", more probably in other drive or in the directory where Eclipse is extracted)
Eclipse (32 bit) and finally ADT.
i tried it and all works fine.
Your computer will always search through the PATH env variable in order, so if you also have the location to your JRE before the location to the JDK in your PATH environment variable, then it will always go with the JRE. Swap their locations around and it should work.
There is a strange issue that may occur while installing the Android SDK on some machines. This may be what you're running into. Here is the solution to it:
Android SDK installation doesn't find JDK

Categories

Resources