JDK directory is not set or invalid (unity)? - java

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

Related

Need help using IntelliJ and setting up a project SDK

When I try to run my program using IntelliJ it says I need a project SDK but when I try to set up a project SDK, it says "The Selected directory is not a valid home for this SDK"
This can happen when a java SDK is deleted, moved, or configured incorrectly.
Go into Project Structure (Ctrl+Alt+Shift+s)
On the left under Project Settings select Project
Now see the Project SDK: - it is likely red if cofigured incorrectly or it might say <No SDK>.
Firstly, just see if there is another SDK of appropriate java version in the drop down list you can use.
If not, you can use Edit button on an existing JDK to modify the JDK home path if it is wrong.
Or just press New... and JDK to set up a JDK that is already installed on your machine (e.g. C:\Program Files\Java\jdk1.8.0_72)
...if you have no JDK on your machine (be aware of the difference between a JRE and a JDK) then you'll obviously need to download and install that first

Android Studio doesn't find Java Development Kit (JDK)

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.

DDMS Files Not Found Android\platform-tools\adb.exe

I have Eclipse and Java SE and am running Windows XP and am trying to setup Android for Eclipse.
I first:
Visit http://developer.android.com.
2. On the main page that appears, click the link to download the Android SDK.
3. Find a link appropriate to your operating system (Windows, Mac OS X, or Linux).
4. Click the link to begin the download.
I installed the Android SDK Tools
I then installed ADT as followed ( note I used http instead of https ) under downloading the ADT plugin.
http://developer.android.com/sdk/installing/installing-adt.html
It gave me some errors saying that somethings needed to be installed which would have been installed if i'd installed Java EE.
I saw a site that said go into the SDK Manager, so I tried installing somethind and it gave me this error:
[2012-06-28 14:32:27 - DDMS] DDMS files not found: K:\Android\platform-tools\adb.exe
[2012-06-28 14:32:27 - DDMS] DDMS files not found: K:\Android\platform-tools\adb.exe
What does this mean, and how can I get Android to work. Do I still need some thigns that Java EE has for Android?
I hate to say it, but restart Eclipse. My recent install gets confused sometimes and that's how I fix it. Hasn't failed to correct it yet.
The file path is wrong. You probably renamed a file in the directory after you installed Eclipse, and now you have to change the file path manually or re-install the program. That's why in the instructions, you are asked to install to developer on your main drive, and not some other file.
After moving eclipse to another drive I experienced this problem. Fix it by setting the SDK folder at Eclipse > Window > Preferences > Android > SDK Location:
Changing the Drive letter from C to E fixed this for me. Locate your eclipse folder on your drive and correct the path or use the browse button.
The path for me was E:\adt-bundle-windows-x86_64-20140702\sdk
Shutdown any other app that might be connecting to the phone via adb.exe eg. Visual Studio using android sdk.
Restart eclipse if needed.
install the installer from http://developer.android.com/sdk/installing/index.html?pkg=tools andriod intaller it will be all right
Set your SDK path in Preferences (Eclipse > Window > Preferences > Android > SDK Location:)

Unable to install Android SDK

I had a Windows XP. I also had JDK6. I downloaded "Android installer r11" for windows. When I click the installer, the error message is displayed as alert Java SE development kit is not found, Then the installation cannot happen.
But in my system I had a Java SE 6. I cannot find why it is not take the Java.
Try this step it may help you:
Installation sequence: JDK, Eclipse, ADT, Android SDK
1. JDK
First, head over to Oracle Web site to download and install the latest Java Development Kit.
Ensure that the environment variables look something like this:
CLASSPATH
C:\Program Files\Java\jdk1.6.0_10\lib;C:\Program Files\Java\jdk1.6.0_10\lib\tools.jar;
C:\Program Files\Java\jdk1.6.0_10\lib\dt.jar;
PATH:
C:\Program Files\Java\jdk1.6.0_10\bin;C:\Program Files\Java\jdk1.6.0_10\jre\bin;
At the command prompt type java-version to view the current system has been installed Java version.
2. Eclipse IDE
Next, from the Eclipse Web site Download the latest Java Eclipse Classic as our development environment, select here eclipse-jee-helios-SR1-win32 version, download the Eclipse is not good need to install, unzip to the right place to use.
3. ADT (Android Development Tools plugin, Android Development Kit)
ADT is an Eclipse plug-in, due to the use of the Eclipse version, the installation process referred to in the following menus and options may vary.
Then, start Eclipse, choose Help-> Install New Software ..., pop-up "Install" dialog box.
Click the Add ... button, pop-up "Add Site" dialog box:
Enter the Android update site here: Location: http://dl-ssl.google.com/android/eclipse// When you're finished, click "OK", back to "Install" dialog box.
In the "Install" dialog box, select just added the update site, waiting to find the appropriate version of Eclipse Select ... "Develpoer Tools" of all items, all the way to click "Next", accept the agreement, click "Install" start the installation.
After the installation is complete, restart Eclipse.
4. Android SDK
Next, from the Google website download the latest android-sdk. Extract the zip file to appropriate directory, remember the absolute path. Run the SDK Manager installation.
In Eclipse, select Windows -> Preference -> Android, enter the directory on the step down the path, click "OK".
The latest SDK, only tools, but no longer contains the platform or the Google add-on, we need to use the "Android SDK and AVD Manager" to install and update, such as platforms, tools, add-ons, and documentation of these SDK components.
%JAVA_HOME% should be in your path. Half of the time you can have an SDK and be missing that variable.
Get thee to a command line and type echo %JAVA_HOME%, or simply see if you get any output from javac -version. The exact variable for Java home is probably not quite right, but the second step should work. If javac fails you, you either never installed Java SDK (aka JDK) and instead got the SE, or you still haven't set the java binary folder into your path. Use your Windows search and look for javac.exe.
If nothing else works, go to java.sun.com and re-download and install a new SDK. The annoying part is that Glassfish and other things tend to complicate the java setup because they too must be set up during install or shortly thereafter.

Error in installing Android Eclipse

hi i have installed the Java eclipse in my system according to the instructions given in http://developer.android.com. After the installation when i was to develop my new project the build target space seems to be empty. One of my friend instructed me to go to windows->Preferences->Android and in the SDK location i have entered the dir where sdk is been loaded (ie in my pc D:\Program Files\android-sdk-windows), but then also no change pls help me to clear my issue...
Check if the location you've specified have the folder hierarchy as below?
Have you also clicked on the 'Apply' or 'Ok' button to reload the location after you're done specifying the location?
It Seems like you have installed SDK but Platform packages were not installed. Go to EClipse - > Window - > Android SDK and AVD Manager, check for Installed packages if that is empty go to available packages and install as per your wish

Categories

Resources