I have installed Java 8 on my computer but Android Studio doesn't find it. When I execute the installer of Android Studio I only can see an screen in which I can see an introduction and when I press "Next" another screen it's displayed in which says:
We could not detect a Java Development Kit (JDK) v7 or newer on your system. Please browse to its path if known.
So I searched my JDK and when I press the button "Next" I get the following message:
Sorry, we still could not detect a valid JDK, which we need to proceed.
If setting your JDK path manually, make sure you have browsed to a parent directory that contains a "bin\java.exe" whose version reports 1.7 or higher when you run "java.exe -version".
After that, I go to the console and execute the command "java.exe -version". It gives to me:
java version "1.8.0_60"
So I don't know why it doesn't find my JDK. I also tried adding some Environment Variables:
JAVA_HOME: C:\Program Files\Java\jre1.8.0_60\
JDK_HOME: C:\Program Files\Java\jre1.8.0_60\
But it still doesn't find it. How can I fix it?
Note: I'm using Windows 10 as OS.
Thanks in advance!
I think your JAVA_HOME variable is set to the wrong thing. Mine is:
JAVA_HOME C:\Program Files\Java\jdk1.8.0_60
I also have a PATH variable set as follows:
PATH %JAVA_HOME%\BIN
I do not have a JDK_HOME variable.
Try that and see if it works.
(I recently installed Android Studio and had the same problem, even though I had Java 7 installed. So I downloaded Java 8 and manually updated the JAVA_HOME variable.)
I had the same problem when trying to install Android Studio bundle v2.1 (143.2915827-windows) on a Windows 10 machine with a JDK at a non-standard location (the JDK on a path containing spaces). After manually selecting the path, the installer would complain that it could still not find a JDK. I solved it by manually enclosing the selected path with double quotes by typing in the editable textbox.
This drove me nuts for a couple of days. I was not able to resolve the issue through the Android studio installer, but found a workaround:
Go to http://developer.android.com/sdk/index.html
Instead of downloading "Android Studio package" (the exe file), scroll down and select "SDK tools package" (the zip file).
This work perfectly and allows you to select all the packages you want to download, including the packages installed by the installer.
What worked for me. I recieved the same error message and went to directly install the java, without closing the installation of Android studio. then tried to find the path. so I closed out the window for Android Studio and Reopened the download file and it automatically detected it. This might not work for everyone but worth a try. easier then messing with everthing else.
Related
I am now creating a keystore for my game (in unity) but when I press the add key button, an error pops up
Java Development Kit (JDK) directory is not set or invalid. Please, fix it in Preferences -> External Tools
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr) (at /Users/builduser/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:187)
I installed the JDK and checked the path of it in the terminal using the command /usr/libexec/java_home, then it shows me that the path of the JDK is /Library/Java/JavaVirtualMachines/jdk-14.0.1.jdk/Contents/Home.
I copy and paste it in the JDK path in unity but the error still pops up.
I actually checked the JavaVirtualMachines in my computer's library but there's nothing in it.
How can I solve this problem? Any help is greatly appreciated.
Actually I solve this problem by adding the modules (Android SDK & NDK Tools, OpenJDK) to my Unity Editor. Actually if you tick the Android build support module, it won't automatically help you to tick the two modules above.
This solved for me in Linux (don't know if the case happens in Windows)
chmod -R 777 ~/Unity
This command set all privileges for all files/directories/subdirectories for the user.
Getting the error of this topic, for curiosity I tried to run the "java" executable inside the directory
~/Unity/Hub/Editor/2021.3.1f1/Editor/Data/PlaybackEngines/AndroidPlayer/OpenJDK/bin/
And got:
bash: ./java: Permission Denied
This explains why set the privileges.
I had the same problem, another solution doesn't work for me!!
I just uninstalled and then installed back using the unity HUB and it's worked.
Click on the three dots and uninstall
then click on add to install back the desired module.
While installing don't forget to check android build support and its all subcategories.
Also, I think I had installed more than one version of unity, that could also be a problem.
Check your Unity installation path in my case
C:\Program Files\Unity\Hub\Editor\2019.4.13f1\Editor\Data\PlaybackEngines\AndroidPlayer
this AndroidPlayer folder in NDK, SDK, and OpenJDK these folders are important for APK file generation.
These files are not properly installed then these files copy for another unity version.
enter image description here
Only one version you have then re-download it.
Edit the environment variable like this path in your case path was different but make sour bin folder is important.
C:\Program Files\Unity\Hub\Editor\2019.4.13f1\Editor\Data\PlaybackEngines\AndroidPlayer\OpenJDK\bin
enter image description here
Solve the problem.
I solve the problem by changing the paths inside:
edit->preferences->external tools
To point to the correct version as I download a different version for the SDK, NDK and JDK when using the hub. This can be done by ticking the checkboxes.
As #Jelly Qwerty answered, installing android platform alone won't install jdk, sdk and ndk. What you got to do is:
Open Unity Hub
Go to "Installs"
Click on the 3 dots on the upper right corner of your unity installation and select "Add Modules" Unity Hub Settings 1
Expand "Android Build Support" and check "Android SDK & NDK Tools" and "OpenJDK". Unity Hub Settings 2
Once the tools are installed you should be able to build your apk.
Cheers
I unchecked and checked the box for "JDK installed with untity" in Preferences>Externals Tools.
A window popped up and it installed some files and it fixed my issue
In Unity hub navigate to your unity versions, in the desire version click the doted menu and select add modules, if you already have android support, it has other options to install the android skd, ndk, and open ndk
There is no 3 dots and there is no installing JDK, Gradle, SDK, or NDK.
I always get Gradle building errors when I install these components manually, although they are the compatible ones of my version.
I want to download them automatically by unity, but the options you are talking about don't exist.
enter image description here
I was trying to install the android studio in my computer (Win 10 - 64x).
By the name, probably the version is 1.4.1:
android-studio-bundle-141.2456560-windows.exe
But I keep receiving a error saying: "We could not detect a Java Development Kit (jdk) v7 or newer on your system."
Currently, I have the jdk1.8.0_71 (64x) version installed. The environment variables JAVA_HOME and JDK_HOME (not sure if this specific one is really necessary) set, and the Path has been edited as well.
As you can see here, every variable and settings are set
Also, I've tried changing the jdk version to the 1.7.0_79 (64x), and I've also tried placing the path between quotes.. But all of it was in vain
It is strange, because I'm a java developer (not android), and I've never seen something like that.
p.s.: Every time I change the system environment variables I restart the computer to ensure the functionality of those variables.
Make sure both your Android Studio & JDK 7 are of either of 64bit or 32bit both. If JDK is of 32bit and Android Studio of 64bit or vice verse, It won't work together.
Assumed that, you have set your JAVA_HOME & PATH correctly.
Thank you SO MUCH Grimmy Vorner!!
I spent my day reading everything and I finally was able to get it working by using the "SDK tools package" (android-sdk_r24.4.1-windows.zip) instead of the "Android Studio package" (android-studio-bundle-143.2915827-windows.exe) from https://developer.android.com/studio/index.html
Also, go to Build -> Edit Build Types -> SDK Location -> JDK Location and make sure it is pointing to the correct jdk version (JDK 7 or JDK 8).
I tried everything that all of you said, but nothing seemed to work. After all I discovered that I can download a zipped version instead of an installation wizard. All I had to do was unzip the android studio and execute the studio64.exe file, and then everything worked perfect.
Still don't understand why it was not working properly with the installation wizard..
Anyway, thank you all for you effort!
I hope that all this information can help others in the future!
when I run android sdk manager ,a small window pops up in
eclipse : it says "initializing..SDK manager will show up shortly.
android studio : "starting sdk manager"
but nothing happens afterwards.
till now i have tried following solutions with no luck:
->changing android.bat to proper java/jre directory with/without quotes.
-> running as administrator
-> deleting the .android folder in c:users.
-> making sure that java directory is before windows/system32 directory.
all the above solutions haven't helped at all. the problem remains still the same.
i m using jdk 8. is it true that android doesn't run with jdk8 and requires jdk7?
because this leaves the setting up java7 as the last option.
Please run directly /tools/android.bat to check whether there is any error message. If you get a JDK not found error. Try the following, if not, forget it.
In general, when you set environment parameters, sdk should be in "PATH" "CLASSPATH", but one time, I have the same situation, when I ran an exe to reinstall JDK. I got an error to ask me to use JAVA_HOME if JDK already installed.
So add the JDK path in JAVA_HOME to have a try.
I'm trying to run eclipse on my Mac OS X. I've been doing some Android programming on Eclipse lately, and today wanted to do some development on Java. However, to my surprise, Eclipse says there's no JRE/JDK installed. I don't know how this is possible, since my android projects have worked very well so far, and even now. I've tried the following items:
Checking java version through the Mac terminal. It says java version "1.8.0_20" is installed. Here's the screenshot.
I've checked the Java version through the Java Control Panel in System Preferences. Again, same thing:
I know that when there's no JRE visible in Eclipse, it can be manually entered through the "add" option under preferences > Java > Installed JREs in Eclipse. But although I can find the Contents folder in this path: /Library/Java/JavaVirtualMachines/jdk1.8.0_20.jdk/home/contents, when I attempt to manually add this in Eclipse, the Java folder under users/library just doesn't show up. I have no idea why this is happening. Here are some screenshots, just in case:
As you can see, the Java folder just doesn't show up under Library in the above screenshot.
Lastly, I've also tried to hit "Search" in Eclipse (same place as "Add" in one of the screenshots above), but "Search" doesn't find anything at all.
I've gone through existing answers on SO which deal with similar problems. The only thing which I haven't done seems to be about setting a path variable, but they were all in Windows OS, so not sure if it applies in my situation.
I'd really appreciate any help on this.
Update 1: According to what has been pointed out so far, I tried copy-pasting the suggested path. But the error I get is: The home directory does not exist.
Here's the screenshot:
You are trying to find the JRE in a wrong Library directory as Library directory maybe present in more than one place. Just copy paste the jre path in 'jre home' input as
/Library/Java/JavaVirtualMachines/jdk1.8.0_20.jdk/home/contents/Home/jre/
EDIT: To find where is your java installed on Mac, run the following command:
echo $(/usr/libexec/java_home)
it should return something like this:
/Library/Java/JavaVirtualMachines/jdk1.7.0_67.jdk/Contents/Home
append jre to the end of this path to build JRE home path:
/Library/Java/JavaVirtualMachines/jdk1.7.0_67.jdk/Contents/Home/jre
I'm using Windows-7 64 bit and I have installed this(jdk-7u45-windows-x64) updated JDK in my system. My SDK was updated upto API level 18(Android 4.3).
When i click on SDK manager in the eclipse, it does not start. I tried open it directly with Administrator permission also. But it does not start. I had tried to set the variable path like these.
But I'm always getting the same error like this.
After I found that in my find_java.exe get the java path from windows\system32 as shown below .
How can I set the Java path to my installed java folder.
Need some one help to figure it out. For Reference look at this link also.
SDK manager not starting
While setting the environment variable try JAVA_HOME variable pointing the bin directory.
because the android checks the java.exe in particular path.
I am new to android,As long as i studied ,Android requires Java 1.5 or 1.6. You are using 1.7
Google does not add complete jdk 1.7 support to android system requirement(some api are exception) .. It does not mean that you should not have jdk 1.7. you should also have 1.6 jdk for compiler compilance. it is a better way to avoid using 1.7 jdk ,if u dont want jdk 1.7 features.
http://developer.android.com/sdk/index.html see the system requirements and even if u developed using 1.7...when you installing your app in real device .we may face signing issue.
you may use some jar file which targetting java 1.7. but android system runtime(dalvik jvm) does not know how to process those files which means dex tool wont process those files which belongs to 1.7 and it wont create classes.dex file..hope it will help somehow
From the error you have posted it seems the problem is only with the path settings.
Add the path upto the bin folder of your jdk - C:\Program Files\Java\jdk1.7.0_45\bin and restart the eclipse.
Please verify if your SDK Location in the Window->Preferences->Android points to the correct SDK path.
Download latest android bundle from http://developer.android.com/sdk/index.html.
and replace new sdk folder with old sdk folder from android bundle folder.
now it's may work.
Finally Reinstalled my OS and Installed JDK 1.6. Then I have added my updated SDK to my ADT. It works fine now.
I've had the same issue, and this solved it