1

I just download the newest Android Studio from the developer site.

After installation I installed Android Studio, then I created new project and after project build completed, I opened my MainActivity.java file to find this error. Please refer to screenshot below:

screenshot

I also downloaded Android SDK component which is built-in already in Android Studio.

Sufian
  • 6,405
  • 16
  • 66
  • 120
Qutbuddin Bohra
  • 1,165
  • 1
  • 11
  • 29
  • Have you tried cleaning your project? ( Build > Clean Project ) ? – AL. Jun 02 '16 at 04:21
  • Related: http://stackoverflow.com/questions/16574189/android-studio-installation-on-windows-7-fails-no-jdk-found – Sufian Sep 20 '16 at 08:04

3 Answers3

1

Start Android Studio and invalidate cache File--> Invalidate Cache and Restart.

0
  1. Rebuild your project. Try clean build. That should do. Faced a similar problem.

Tools -> Android -> Sync Project with Gradle Files

Build -> Rebuild

  1. Incorrect installation of JDK also might cause problems. Please tell what the error is in detail.

  2. You can try this for JDK Installation:-

On some Windows systems, the launcher script does not find where the JDK is installed. If you encounter this problem, you need to set an environment variable indicating the correct location. Select Start menu > Computer > System Properties > Advanced System Properties. Then open Advanced tab > Environment Variables and add a new system variable JAVA_HOME that points to your JDK folder, for example C:\Program Files\Java\jdk1.8.0_77.

Vibhu Dadhichi
  • 1,099
  • 16
  • 21
0

Goto File -> Project Structure on left hand side click on SDK Location there you can find Android SDK Location and JDK Location. So, now locate your JDK path by browsing your JDK installation path. Click OK, Now goto Build -> Rebulid your project.

It's better to check whether the JDK path set in Environment variable by typing java -version in commmand prompt. If it is not set, set the path as DvD said in his post.

Hope this works for you.

Community
  • 1
  • 1
Shashanth
  • 4,995
  • 7
  • 41
  • 51