This message was deleted.
# community-support
s
This message was deleted.
v
VSC is not an IDE, but a fancy text editor. If you want a proper IDE, use IntelliJ or Android Studio. 😉 But regarding your error, can you provide the full error and not just an excerpt please? Or even better, a build
--scan
?
y
woowww thx sirr, btw my lecturer just asked us to use vsc 😄 so this is the full error : Could not run phased build action using connection to Gradle distribution 'https://services.gradle.org/distributions/gradle-7.4.2-bin.zip'. org.gradle.api.ProjectConfigurationException: A problem occurred configuring root project 'android'. A problem occurred configuring root project 'android'. A problem occurred evaluating root project 'android'. A problem occurred configuring project ':app'. Build file 'C:\Users\M S I\OneDrive\Documents\kuliah after kemalingan\semester 3\prak apk mobile\flutter_application_1\flutter_application_1\android\app\build.gradle' line: 2 An exception occurred applying plugin request [id: 'com.android.application'] Failed to apply plugin 'com.android.internal.application'. Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8. Your current JDK is located in C:\Program Files\IBM\SPSS\Statistics\25\JRE You can try some of the following options: - changing the IDE settings. - changing the JAVA_HOME environment variable. - changing
org.gradle.java.home
in
gradle.properties
.
v
And what is unclear? The message seems quite explicit
Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8.
y
but i was checked my java version in cmd is 20.0.1
v
Obviously that's irrelevant 🙂
Besides that it would be better either, as you use Gradle 7.4.2 which does not support running on Java 20
If you run from VSC check what Java it uses to run Gradle, I have no idea about Gradle integration in VSC.
If you run from commandline check your
JAVA_HOME
environment variable
You can also see the used Java version in
./gradlew --version
output
d
Outside of anything else in this thread, one of the first items it to not use VS Code for Android development. You’ll want to use Android Studio (AS) for the easiest starting point. Just do be aware that AS also sets a java version that will be used in favor of your
JAVA_HOME
or anything in your
gradle.properties
. To ensure that is what you’d expect go Android Studio -> Settings - Build, Execution, Deployment -> Build Tools -> Gradle and ensure the value for Gradle JDK is what you want. Just make sure you follow the compatibility matrix of AS, AGP and Gradle, or things won’t work - https://developer.android.com/build/releases/gradle-plugin#android_gradle_plugin_and_android_studio_compatibility
v
@Daniel B Duval you might have seen that in my first message I already advise to use an IDE instead of a fancy text editor. But he probably does not have the freedom to follow our advice as his lecturer asked him to use that "thing". 🙂
d
😸 . Then the OP can also go back to class and show the lecturer how this has to work 😉 The extra details about JAVA_HOME, etal., are there as it feels like the users may need a little bit of extra guidance…
d
it might help to understand how JAVA_HOME works
Your current JDK is located in C:\Program Files\IBM\SPSS\Statistics\25\JRE
this is probably the value of JAVA_HOME which vs code sees. generally a java installation is structured in a directory which has a "bin" folder, inside of which is "java", and in the case of a full jdk (not jre) also "javac" "javadoc" "jar" some profiling tools, etc... you can use a tool like sdkman to download jdks and set your JAVA_HOME variable. it can even change the variable on the fly. (
sdk use java 17.0.8.1-tem
or
sdk use java 21-open
). sdkman windows support is currently that you'll have to download your own "zip" program and place it "in your path", but it works great with Git Bash for windows - which you have to install anyways as git is a prerequisite for most software development anyways these days.