All the code was working perfectly and nothing was wrong. Suddenly when i want to run the app it gives me this one error.
I have not touched the code.I tried uninstalling
This kind of error mostly happens for not using embedded JDK, I face this error in my Android studio 4.0.1 whenever I point my JDK location to "/Library/Java/JavaVirtualMachines/jdk-14.0.2.jdk/Contents/Home"(This is my mac location for JDK, for window it might be different).
I follow the below steps to solve it.
Go to File -> Project Structure.
On the left side, click on SDK Location and go to JDK Location.
Change it to the Embedded JDK that comes with Android Studio.
Click on OK.