
#Solution : 1 (For Perticular Project Config)
Follow below steps to resolve JDK issue :
:
1. Update android/gradle.properties (Replace all the lines below)
org.gradle.jvmargs=-Xmx4096m -Dfile.encoding=UTF-8
android.useAndroidX=true
android.enableJetifier=true
org.gradle.java.home=Path of JDK
2. Run below command and get JDK path
echo $JAVA_HOME
It will return the JDK path. Replace this path in the Path of JDK in Step 1.
You can also refer to the below screenshot for better understanding.
https://www.divinetechs.com/support/storage/app/public/ticket/25_02_2025_83_67bd5dffd583a.png
#Solution : 2 (For All Projects)
To set the version of Java that all flutter projects use run flutter config --jdk-dir=SOMEJAVAPATH
where SOMEJAVAPATH is a path to a Java version like /opt/homebrew/Cellar/openjdk@17/17.0.13/libexec/openjdk.jdk/Contents/Home
Run below command and get JDK path
echo $JAVA_HOME
Whether you're troubleshooting an issue or looking for step-by-step guidance, our resources are designed to empower you with the knowledge you need
Leave a Comment