I'm using macOS 11.3 and I currently have an Android project with the Android Gradle plugin version 3.2.1 and Gradle version 3.4 that I'm trying to compile with Android Studio 4.2.1. As this version of Android Studio comes with JDK 11 as a runtime, I've tried to change the runtime of the IDE as detailed here and here
but I'm getting the following error:
Could not determine Java version using executable /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java.
The project uses Gradle 3.4 which is incompatible with Java 10 or newer.
See details at https://github.com/gradle/gradle/issues/4503
Possible solution:
Upgrade Gradle wrapper to 4.8.1 version and re-import the project
Upgrading the Gradle version is not an option in my case due to it's a legacy project that is no longer maintained and in the end, I would have some other compilation problems.
What I've tried to do is change the JDK of Android Studio to use JDK 8 as detailed but I'm getting the error "Could not determine Java version using executable /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java."
Does anybody has had the same problem? Can it be related to the path set on the Java_HOME variable?
This seems to be similar to this.
You can uninstall all existing JDK versions including 11 and install Java 8. Then try again after setting version 8 in your Studio as well as in the environment variable (JAVA_HOME path).
Hope that works for you!
Related
"General error during conversion: Unsupported class file major version 63"
I've tried multiple suggestions on here. None have worked. I think I need more of a step-by-step solution because I've tried installing multiple versions of Java (19,16,11), flutter clean, flutter doctor is all good, and I've installed a newer version of Android Studio (just in case). Here is what I see in VSCode:
I encountered this error while trying to run Flutter integration tests on Firebase Test Lab. I was able to solve this by updating a few things in Android Studio.
Update the Project's JDK
Open the Android Studio project settings page (File -> Project Settings) and add the newest JDK version.
Update com.android.tools.build:gradle
In android/build.gradle, update the com.android.tools.build:gradle value to the latest version found here.
dependencies {
classpath 'com.android.tools.build:gradle:7.4.1'
...
}
Update the gradle distributionUrl
In android/gradle/wrapper/gradle-wrapper.properties, update the distributionUrl property to use the latest Gradle version.
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-all.zip
Other Useful Tips
You can type /usr/libexec/java_home into the terminal to see which version of Java you have installed.
You can find the current value of JAVA_HOME by running %echo $JAVA_HOME in your terminal (source).
You can update JAVA_HOME by following these steps
The problem is that somehow, either deliberately or inadvertently, you've built one or more Java files (or you're using one or more 3rd party .jars) with Java 19 ... but your "build environment" is using an older JRE. Hence the Unsupported class file error.
I, too, am using VSCode for my Flutter IDE; and I, too have Android Studio in my environment. Unfortunately, there are constantly new releases for Flutter, for VSCode, for the Android SDK, for Android Studio (with its own embedded Java/Kotlin!) and - last, but not least - for Gradle and the A/S Gradle plugin. Any one of them falling out of sync can break your entire development environment :(
I just tried to rebuild a project that compiled fine a few months ago... and (as expected) the build failed. None of the source change - but I recently upgraded A/S, and that inadvertently broke the Flutter build :(
SUGGESTION:
See if you can identify which Java class or .jar is using Java 19 ... and back it down to an older version.
In parallel, upgrade EVERYTHING in your build environment:
flutter upgrade => Flutter 3.7.3, Dart 2.19.2
VSCode update, pub upgrade => VSCode 1.751, Dart Code 3.58.0
A/S upgrade => Electric Eel 2022.1.1 Patch 1, Gradle Plugin 4.2.2
Note: Gradle Plugin 4.2.2 => Gradle version => 6.7.1, Default=Java8, AGP dependency 4.2.2
A/S Electric Eel gives you java 11... in (new!) directory "c:\Program Files\Android\Android Studio\jbr"
I am currently using Gradle 3.0, which supports JDK 9. I tried to download JDK 9 from Oracle's official website but you need an account for the archived versions (they require a company name and a work phone, none of which I can provide). My version of JDK is 15.0.1. As far as I know, the latest version of Gradle supports it. However, I'm not sure how to update Gradle in my workspace. Would updating it cause any errors since it's a huge gap between the versions?
For reference, the older version of Gradle came with the mod developer kit of the forge. I am currently working on the 1.8.9 version of Minecraft. I am using IntelliJ, not Eclipse. I apologize if I didn't structure my question properly.
IntelliJ IDEA has JDK downloader that offers multiple JDK versions/vendors. You can use JDK 1.8 for Gradle 3.0 or JDK 11 for Gradle 5.0+:
Just Install sdkman.io
Then upgrading the Gradle/maven/jdk and many other JVM project is as easy as running a command.
You can also switch between versions in a very convenient way.
I have an old WebSphere app that I'm trying to compile with Java 1.5. I'm working in in IntelliJ on Windows 10. In my Project Settings I have the Project SDK set as:
1.5 (java version "1.5.0_22")
I also have 1.8 available, but it's definitely not what's selected in the Project SDK.
When I do a rebuild on my project I see:
Information:javac 1.8.0_152-release was used to compile java sources
It seems to build just fine, but when I try to visit my local website I see:
Error 500: (PathToMYServletGoesHere) bad major version at offset=6
I understand that this is error is related to a version mismatch.
Thanks
Sbt is giving me an error:
The Java Development Kit (JDK) installation you have is not up to date. sbt requires at least version 6+, you have version 0
But I have the latest version of Java.
It appears this is another bug in sbt with the Windows build. There was an issue opened that intended to fix this in the latest sbt release (1.1.4), however it does not appear it actually fixed the issue.
I just read How to have Eclipse use JDK8 to compile a project?
What i added jdk8 to eclipse as,
From the answers of How to have Eclipse use JDK8 to compile a project?
I tried to Update the JDT/Core, JDT/UI bundles from http://dist.springsource.com/snapshot/TOOLS/java8/e43
But it shows error as,
"Eclipse Java Development Tools Patch for Java 8 Support (BETA)" is not applicable to the current configuration and will not be installed.
"Eclipse Plug-in Development Environment Patch for Java 8 Support (BETA)" is not applicable to the current configuration and will not be installed.
How Can i fix it ?
I can say that Java 1.8 does in fact work with Eclipse Luna ( the beta version released around March 17, 2014) or later. I tried it and it was good.
Also, I noticed that in the Eclipse Marketplace, there are now plugins to install functionality into Kepler to support JDK1.8. I haven't tried the plugin myself though.
This is a old topic but I just wanted to point out that I have searched enough to find that Indigo version can't be updated to S.E 1.8 here the link which is given on eclipse website to update the Execution Environment but if you try it will throw error for Indigo.
Here is the link where the Information about execution environment is given.
This shows the step by step to update Execution environment.
I have tried to update Execution environment and I got the same error.