10

I just downloaded Google's new android studio bundle(x64 for Windows) and also installed JDK8 (C:\Program Files\Java\jdk1.8.0_25) (x64 version).

But on the android studio setup it does not detect JDK and asks to locate its path. I located its path but still it says it is not valid.

I tried declaring new Environment variables (both system and User) but still I get same error.

I also tried in cmd, and it says that java & JDK is installed.

After that I reinstalled JDK 8 for windows x64 from Oracle. But no changes in android studio...

Please Help. !

Mei Tetra
  • 103
  • 1
  • 1
  • 5
  • http://javatechig.com/android/installing-android-studio – Nooh Mar 16 '15 at 06:22
  • Note the answer lower down, which is that if you installed Java in response to the prompt in Android Studio... *it may not notice*; even if you hit back and next. Closing the installer, finding the installer in the Downloads directory, and then running it again worked for me. – HostileFork says dont trust SE May 03 '16 at 18:04

6 Answers6

11

I had the same problem. I discovered that it was caused because I installed the JDK while the Android Studio installer was still opened and at the prompt to load the location of the JDK. Closing the Android installer and then reloading it after the JDK installation had completed and was closed out, solved the installation problem for me.

user5803922
  • 119
  • 1
  • 2
  • This does not really answer the question. If you have a different question, you can ask it by clicking [Ask Question](http://stackoverflow.com/questions/ask). You can also [add a bounty](http://stackoverflow.com/help/privileges/set-bounties) to draw more attention to this question once you have enough [reputation](http://stackoverflow.com/help/whats-reputation). - [From Review](/review/low-quality-posts/10930548) – gio Jan 18 '16 at 08:35
  • 2
    @gio In my case, this was exactly the answer. – HostileFork says dont trust SE May 03 '16 at 18:01
  • this is the answer for me – Ryan Aug 09 '16 at 01:01
3

In my case, I am using java8 and based on Doc I just had to add the following:

 implementation "androidx.lifecycle:lifecycle-common-java8:$lifecycle_version"
Mustafa Shahoud
  • 640
  • 6
  • 13
2

While running Java 6 something I tried to install Android Studio. Android Studio did not find Java 7 or Java 8, so it asked me to install at least Java 7 and gave a link to Java 7. While the original instance of Android Studio Installer was still alive, it would not find Java 7 or 8. killing and restarting Android Studio Installer worked just fine. So install Java and restart the installer.

2

I have same error but i closely look into the note and then my problem solved :)

enter image description here

nafees ahmed
  • 948
  • 1
  • 12
  • 18
1

It needs JDK 7, as stated on the System Requirements page: http://developer.android.com/sdk/index.html#Requirements

Update:

For Android Studio 2.1, it needs JDK 8 for Windows or Linux, and JDK 6 for Mac.

Daniel Nugent
  • 43,104
  • 15
  • 109
  • 137
  • 1
    It's not true cause I am using android studio with JDK 8. – Mohit Mar 16 '15 at 06:32
  • Interesting. Are you sure you don't have 7 installed as well? There's more info here: http://stackoverflow.com/questions/23318109/is-it-possible-to-use-java-8-for-android-development – Daniel Nugent Mar 16 '15 at 06:38
  • more then 100% sure.I have JDK 8 with no problems. – Mohit Mar 16 '15 at 06:39
  • Good to know! I've installed Android Studio on a Mac and a Linux machine, it wouldn't even install for me with only JDK 8. On the Mac I even had to install JRE 6 for it to open after installation, just like the Requirements page states. – Daniel Nugent Mar 16 '15 at 06:42
  • I am using it on windows 8.1.Maybe issues are only with mac and linux. – Mohit Mar 16 '15 at 06:45
  • I am using windows 8 Pro. And I also have the older version of android studio where the IDE does not load. – Mei Tetra Mar 16 '15 at 12:43
0

I solved this problem by closing the installation file, and open it again as an administrator. Pre over the need to set jdk.