Android Studio Gradle Sync Error - Unsupported Java
I am on Linux (Arch Linux) and using Android Studio 2.3.1
When creating a new empty project in Android Studio, I get the error:
Gradle sync failed:
org.gradle.internal.jvm.UnsupportedJavaRuntimeException.assertUsingVersion(Ljava/lang/String;Lorg/gradle/api/JavaVersion;)V
Consult IDE log for more details (Help | Show Log)
It seems there is something with the java version. I installed openjdk-8 and also tried with Oracle JDK version 8 (also tried with version 7).
Things I've tried:
-
Using installed gradle or gradle that comes with Android Studio
-
Removing
~/.gradle
and~/.android
.
Update: If I go into the project directory and run gradle build
, i.e. using my installed version of gradle, it seems to be created. However, being able to run gradle from Android Studio seems necessary even to use Android Studio.
source to share
I upgraded to Android Studio 2.3.2 and then this specific issue was resolved.
I did not use the package from the AUR (Arch User Repository) when updating, instead I used Android Studio "Check for Updates" and updated this path. I don't know if this matters.
Update: Happened again when upgrading to Android Studio 3.0.1 from AUR. Installing the official build from http://developer.android.com works, although this is a build issue in the AUR for ArchLinux.
source to share
I had the same problem AFAIK.
First, I had a version prior to 3.0.1 Android, then I downloaded the Android zip package from the official site, then installed it and kept the same old preference files (or so). Then this problem appeared. What I did was uninstall (thus the Android version deleted folder from Ubuntu point of view) and reinstall it and it was resolved.
source to share