0

I have tried so many options

  • Changed jdk path from recommended to manual path to my JDK folder.
  • Added System.properties("java.home") in gradle dependencies.
  • Uninstalled jdk and reinstalled.
  • Invalidated & restart.
  • Added java_home=c\:\\program files\\... path in gradle.properties file.

when checked stack trace I got: could not find tools.jar: please check valid installation error

But none of them worked. I still get this error.. struck from last 4 days...

Can anyone suggest anything, please?

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
Sagar P
  • 13
  • 4

2 Answers2

0

Enable use recommended jdk option from Android studio and add below code to your gradle.

compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
Danial clarc
  • 724
  • 1
  • 7
  • 25
0

I have tried so many solutions and finally found the solution for the error Execution failed for task ':module:compileDebugJavaWithJavac'

First you need to check the java JRE and JDK version installed in your system. It should be java 11 or higher

If the version is below 11 then update that version and your problem will be resolved.

if you want to know current java JDK and JRE version and want to update it then refer to this link

Behnam Maboudi
  • 655
  • 5
  • 21