Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio - Could not determine Java version

I installed a fresh copy of Android Studio using terminal but when i create a new project it gives the error "Could not determine Java Version". JDK and SDK both are installed. Android Studio is updated to the latest version. I am using Ubuntu 14.04 LTS

like image 774
Zimad Avatar asked Sep 07 '25 12:09

Zimad


2 Answers

Change this:

targetCompatibility 'JavaVersion.VERSION_1_8'
sourceCompatibility 'JavaVersion.VERSION_1_8'

to this:

targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_1_8
like image 158
no_cola Avatar answered Sep 09 '25 02:09

no_cola


I faced the same issue, but on windows 7 OS. It was because multiple versions of java was present in the same location C:\Program Files\Java Java 5, 7, 8, and 9. Although the Environment variables JAVA_HOME and PATH were set to Java 8, Android studio was referring to Java 9.

My Solution, in the menu, click on File > Project Structure here, point JDK to appropriate location C:\Program Files\Java\jdk

like image 27
Anantha Raju C Avatar answered Sep 09 '25 02:09

Anantha Raju C