简体   繁体   English

Android SDK 安装没找到JDK

[英]Android SDK installation doesn't find JDK

I'm trying to install the Android SDK on my Windows 7 x64 System.我正在尝试在我的 Windows 7 x64 系统上安装 Android SDK。

jdk-6u23-windows-x64.exe is installed, but the Android SDK setup refuses to proceed because it doesn't find the JDK installation. jdk-6u23-windows-x64.exe已安装,但Android SDK安装程序拒绝继续,因为它找不到JDK安装。

Is this a known issue?这是一个已知的问题? And is there a solution?有解决办法吗?

SDK错误

Press Back when you get the notification and then Next .收到通知后按Back ,然后按Next This time it will find the JDK .这次它会找到JDK

Actual SETUP:实际设置:

  • OS : Windows 8.1操作系统:Windows 8.1
  • JDK file: jdk-8u11-windows-x64.exe JDK文件:jdk-8u11-windows-x64.exe
  • ADT file: installer_r23.0.2-windows.exe ADT文件:installer_r23.0.2-windows.exe

Install the x64 JDK , and try the back-next option first, and then try setting JAVA_HOME like the error message says, but if that doesn't work for you either, then try this:安装x64 JDK ,然后先尝试 back-next 选项,然后尝试像错误消息所说的那样设置JAVA_HOME ,但如果这对您也不起作用,请尝试以下操作:

Do as it says, set JAVA_HOME in your environment variables, but in the path use forward slashes instead of backslashes.按照它说的做,在您的环境变量中设置JAVA_HOME ,但在路径中使用正斜杠而不是反斜杠。

Seriously.严重地。

For me it failed when JAVA_HOME was C:\\Program Files\\Java\\jdk1.6.0_31 but worked fine when it was C:/Program Files/Java/jdk1.6.0_31 - drove me nuts!对我来说,当JAVA_HOMEC:\\Program Files\\Java\\jdk1.6.0_31时它C:\\Program Files\\Java\\jdk1.6.0_31但是当它是C:/Program Files/Java/jdk1.6.0_31时工作正常 - 让我发疯!

If this is not enough, also add to the beginning of the Environment Variable Path %JAVA_HOME%;如果这还不够,还要在环境变量Path的开头加上%JAVA_HOME%;

Updated values in System Environment Variables:系统环境变量中的更新值:

  • JAVA_HOME=C:/Program Files/Java/jdk1.8.0_11
  • JRE_HOME=C:/Program Files/Java/jre8
  • Path=%JAVA_HOME%;C:...

I found the solution and it's beautifully stupid.我找到了解决方案,它非常愚蠢。 I found Android SDK cannot detect JDK .我发现Android SDK 无法检测到 JDK

Press the Back button on the SDK error screen that tells you that the EXE couldn't detect the JDK.在 SDK 错误屏幕上按后退按钮,告诉您 EXE 无法检测到 JDK。 Then press Next .然后按下一步

Who would have thought that would happen?谁会想到会发生这种情况?

It seems like it doesn't work without 32 bit JDK.如果没有 32 位 JDK,它似乎不起作用。 Just install it and be happy...只需安装它并快乐......

I downloaded the .zip archive instead and ran SDK Manager.exe , and it worked like a charm.我下载了 .zip 存档文件并运行了SDK Manager.exe ,它的作用就像一个魅力。 You had the same issue with the .exe otherwise.否则,您对 .exe 也有同样的问题。

Warning: As a commenter mentioned, don't try this on a Windows 7!警告:正如评论者提到的,不要在 Windows 7 上尝试这个! I tested it with Windows XP 64 bit.我用 Windows XP 64 位对其进行了测试。

As the posted solution does NOT work for all (including me, myself, and I), I want to leave a note for those seeking for another way (without registry hacking, etc.) to solve this on a Windows 64 bit system.由于发布的解决方案不适用于所有人(包括我,我和我),我想为那些寻求另一种方式(没有注册表黑客等)在 Windows 64 位系统上解决此问题的人留下一张便条。 Just add PATH (capital letters!!) to your environment Variables and set the value to your JDK-Path.只需将 PATH(大写字母!!)添加到您的环境变量并将值设置为您的 JDK-Path。

I added JDK to the existing "Path" which did not work, like it didn't with JAVA_HOME or the "Back"-Solution.我将 JDK 添加到现有的“路径”中,但它不起作用,就像它没有与 JAVA_HOME 或“返回”-解决方案一样。 Adding it to "PATH" finally did the trick.将它添加到“PATH”终于成功了。

I hope this might be helpful for somebody.我希望这可能对某人有帮助。

All you need are the following two registry entries.您只需要以下两个注册表项。 It appears as if whoever posted the other registry stuff basically just copied all the keys from HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft into HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\JavaSoft , which obviously isn't an ideal solution because most of the keys aren't needed.似乎发布其他注册表内容的人基本上只是将HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft所有键复制到HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\JavaSoft ,这显然不是理想的解决方案,因为大多数键都不需要。

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\JavaSoft\Java Development Kit]
"CurrentVersion"="1.6"

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\JavaSoft\Java Development Kit\1.6]
"JavaHome"="C:\\Program Files\\Java\\jdk1.6.0_23"

Non of these solutions worked for me.这些解决方案都不适合我。 I fixed it by temporarily changing the filename of C:\\Windows\\System32\\java.exe to java_.exe我通过临时将C:\\Windows\\System32\\java.exe的文件名C:\\Windows\\System32\\java.exejava_.exejava_.exe

None of the solutions here worked for the 64-bit version.这里的解决方案都不适用于64-bit版本。

Putting the JDK path before the c:\\windows\\system32\\ path in your environment variables solves the problem.JDK路径放在环境变量中的c:\\windows\\system32\\路径之前可以解决问题。 Otherwise the 32-bit java.exe is found before the 64-bit JDK version.否则32-bit java.exe会在64-bit JDK版本之前找到。

After reading a couple of blog posts, it does seem to be even an easier fix by clicking BACK when the installer says couldn't find the JDK, and then simply click NEXT again and magically it finds the JDK.在阅读了几篇博客文章后,当安装程序说找不到 JDK 时单击BACK似乎更容易修复,然后只需再次单击NEXT并神奇地找到 JDK。 No registry messing around or re-downloading etc..没有注册表乱七八糟或重新下载等。

Adding JAVA_HOME environment variable (under System Variables ) did the trick for me.添加 JAVA_HOME 环境变量(在System Variables 下)对我有用。 Clicking "Back" and "Next" buttons didn't work.单击“返回”和“下一步”按钮不起作用。

Windows 7 Professional x64, JDK 1.7.0_04 (64 bit, I don't have x86 version installed) Windows 7 Professional x64,JDK 1.7.0_04(64 位,我没有安装 x86 版本)

I think that installer tries to find JDK in specific (1.6?) version and if it can't find it, checks JAVA_HOME which was not set in my case.我认为安装程序会尝试在特定(1.6?)版本中找到 JDK,如果找不到,请检查在我的情况下未设置的 JAVA_HOME。 I have another computer (the same system but with JDK 1.6 x64) and it worked without JAVA_HOME variable.我有另一台计算机(相同的系统,但使用 JDK 1.6 x64)并且它在没有 JAVA_HOME 变量的情况下工作。

You don't have to install 32 bit version of JDK :)您不必安装 32 位版本的 JDK :)

I copied the Java.exe from我从

C:\\Windows\\System32 C:\\Windows\\System32

to

C:\\Windows\\SysWOW64 C:\\Windows\\SysWOW64

and it worked.它奏效了。

I'm using 64 bit Windows 8.我正在使用 64 位 Windows 8。

Setting the JAVA_HOME environment variable toJAVA_HOME环境变量设置为

C:\\Program Files\\Java\\jdk1.7.0_07

instead of代替

C:\\Program Files\\Java\\jdk1.7.0_07\\bin

fixed it for me.为我修好了。

The guy above who put this: "I experienced this problem too, but none of the answers helped. What I did, I removed the last backslash from the JAVA_HOME variable and it started working. Also, remember not to include the bin folder in the path."上面那个提出这个问题的人:“我也遇到过这个问题,但没有一个答案有帮助。我所做​​的是,我从 JAVA_HOME 变量中删除了最后一个反斜杠,它开始工作。另外,记住不要将 bin 文件夹包含在小路。” This was in fact the correct answer.这实际上是正确的答案。

For this SDK to install this is what I did.为了安装这个SDK,我就是这样做的。 I am running the latest Microsoft OS Windows 8.我正在运行最新的 Microsoft 操作系统 Windows 8。

User Variables:用户变量:

Path C:\\Program Files\\Java\\jdk1.7.0_07\\bin路径C:\\Program Files\\Java\\jdk1.7.0_07\\bin

Environment Variables环境变量

Create these two:创建这两个:

CLASSPATH %HOME_JAVA%\\jre\\lib%HOME_JAVA%\\jre\\lib

HOME_JAVA C:\\Program Files\\Java\\jdk1.7.0_09 HOME_JAVA C:\\Program Files\\Java\\jdk1.7.0_09

This one already exists so just edit:这个已经存在所以只需编辑:

Path At this end of WindowsPowerShell\\v1.0\\ simply add " ;C:\\Program Files\\Java\\jdk1.7.0_09"路径 在WindowsPowerShell\\v1.0\\这一端添加“ ;C:\\Program Files\\Java\\jdk1.7.0_09"

This is what I did and it worked for me.这就是我所做的,它对我有用。 =) =)

这个注册表修复在我的 Windows 7 x64 设置中就像一个魅力: http : //codearetoy.wordpress.com/2010/12/23/jdk-not-found-on-installing-android-sdk/

Press Report error and OK .报告错误确定 Next will be enabled.接下来将启用。

尝试下载并安装压缩版本而不是 .exe 安装程序。

Also, RUN AS ADMINISTRATOR !另外,以管理员身份运行 Worked for me with backslash fix.使用反斜杠修复为我工作。

I had the same problem, tried all the solutions but nothing worked.我遇到了同样的问题,尝试了所有解决方案,但没有任何效果。 The problem is with Windows 7 installed is 64 bit and all the software that you are installing should be 32 bit.问题在于安装的 Windows 7 是 64 位,而您安装的所有软件都应该是 32 位。 Android SDK itself is 32 bit and it identifies only 32 bit JDK. Android SDK 本身是 32 位的,它只识别 32 位的 JDK。 So install following software.所以安装以下软件。

  1. JDK (32 bit) JDK(32 位)
  2. Android SDK (while installing SDK, make sure install it in directory other than "C:\\Program Files (x86)", more probably in other drive or in the directory where Eclipse is extracted) Android SDK(安装SDK时,请确保将其安装在“C:\\Program Files (x86)”以外的目录中,更有可能在其他驱动器或Eclipse解压目录中)
  3. Eclipse (32 bit) and finally ADT . Eclipse(32 位),最后是ADT

I tried it and all works fine.我试过了,一切正常。

我遇到了同样的问题,并通过安装 x86 版本的 JDK(在 Windows XP x64 上)解决了这个问题。

I experienced this problem too, but none of the answers helped.我也遇到过这个问题,但没有一个答案有帮助。 What I did, I removed the last backslash from the JAVA_HOME variable and it started working.我做了什么,我从 JAVA_HOME 变量中删除了最后一个反斜杠,它开始工作。 Also, remember not to include the bin folder in the path.另外,请记住不要在路径中包含 bin 文件夹。

Android SDK 是 32 位应用程序,它需要 32 位 JDK 才能工作...... 64 位 JDK 对它没有任何用处......

WORKING SOLUTION AND NO REGISTRY MODIFY NEEDED工作解决方案,无需修改注册表

Simply put your java bin path in front of your PATH environment.只需将您的 java bin 路径放在您的 PATH 环境前面。

PATH before之前的路径

C:\Windows\system32;C:\Windows\%^^&^&^............(old path setting)

PATH after路径之后

C:\Program Files\Java\jdk1.6.0_18\bin;C:\Windows\system32;C:\Windows\%^^&^&^............(old path setting)

And now the Android SDK installer is working.现在 Android SDK 安装程序正在运行。

BTW, I'm running Win7 x64.顺便说一句,我正在运行 Win7 x64。

1-Simply done the "JAVA_HOME" environment variable thing. 1-简单地完成了“JAVA_HOME”环境变量的事情。

2-Right-Click on Android SDK and from compatibletiy Tab Select windows 7 and administrator. 2-右键单击 Android SDK 并从兼容选项卡中选择 windows 7 和管理员。

3-Run it again. 3-再次运行它。

For installer_r21.1-windows.exe on Windows 8 x 64 what worked for me was setting up my user environment variable JAVA_HOME to C:\\Program Files\\Java\\jdk1.7.0_10.对于 Windows 8 x 64 上的 installer_r21.1-windows.exe,对我有用的是将我的用户环境变量 JAVA_HOME 设置为 C:\\Program Files\\Java\\jdk1.7.0_10。 Hope this helps you all!希望这对大家有帮助! :) :)

Yeah install the 32 bit version of the Java SE SDK (or any of the combinations).是的,安装 32 位版本的 Java SE SDK(或任何组合)。 That should help solve your problem.这应该有助于解决您的问题。

The above methods did not work for me in Windows 8 Pro.上述方法在 Windows 8 Pro 中对我不起作用。

Just set the path to只需将路径设置为

C:\Program Files\Java\jdk1.7.0_07\

Where C is your drive in which you have installed the JDK.其中 C 是安装了 JDK 的驱动器。

Don't forget the backward slash at the end.不要忘记末尾的反斜杠。

I'm running a 64-bit version of Windows 7 and I was getting this issue when attempting to install Android Studio 1.0 using the executable from:我正在运行 64 位版本的 Windows 7,在尝试使用以下可执行文件安装 Android Studio 1.0 时遇到此问题:

http://developer.android.com/tools/studio/index.html http://developer.android.com/tools/studio/index.html

I tried all the listed solutions and several different versions of JDK 1.7 and 1.8 -- no dice.我尝试了所有列出的解决方案和几个不同版本的 JDK 1.7 和 1.8 —— 没有骰子。 I went with installing the zipped version of the application and it worked like a charm:我安装了该应用程序的压缩版本,它的工作原理很吸引人:

http://tools.android.com/download/studio/canary/latest http://tools.android.com/download/studio/canary/latest

Still baffled by this problem;还是被这个问题搞糊涂了; especially since beta versions of Android Studio worked just fine.特别是因为 Android Studio 的测试版工作得很好。

You will have to download the 32-bit SDK version because Win7 64-bit is not supported only Windows Server 2003 has a supported 64-bit version.您必须下载 32 位 SDK 版本,因为不支持 64 位 Win7,只有 Windows Server 2003 支持 64 位版本。 During the download of Java SDK pick "Windows" as your platform and not "Windowsx64".在下载 Java SDK 期间,选择“Windows”作为您的平台,而不是“Windowsx64”。
Once I did this android SDK installed like a charm.一旦我安装了这个 android SDK,就像一个魅力。 Hope this helps.希望这可以帮助。

For Windows users:对于 Windows 用户:

You would set JAVA_HOME environment variable: http://wso2.org/project/wsas/java/1.1/docs/setting-java-home.html您将设置 JAVA_HOME 环境变量: http://wso2.org/project/wsas/java/1.1/docs/setting-java-home.html

I tried several posted solutions and then it took a system reboot before it started working, which may have been because I had just installed the JDK.我尝试了几个已发布的解决方案,然后在它开始工作之前重新启动了系统,这可能是因为我刚刚安装了 JDK。 Here are all the things I had going on - not sure which ones were essential:以下是我所做的所有事情 - 不确定哪些是必不可少的:

  • 64-bit JDK installed.已安装 64 位 JDK。
  • JAVA_HOME defined using forward slashes (/) instead of backslashes (). JAVA_HOME 定义使用正斜杠 (/) 而不是反斜杠 ()。
  • JDK 'bin' directory listed at beginning of PATH. JDK 'bin' 目录列在 PATH 的开头
  • System reboot.系统重启。

This issue has been fixed on SDK revision 20.xxx此问题已在 SDK 修订版 20.xxx 上修复

Download it via http://dl.google.com/android/installer_r20.0.3-windows.exe通过http://dl.google.com/android/installer_r20.0.3-windows.exe下载

You might want to restart your machine.您可能需要重新启动机器。 For me, without having to use forward slashes it worked after I restarted windows.对我来说,无需使用正斜杠,它在我重新启动 windows 后就起作用了。

Install both JDK 64 bit 1.6 for Windows and JRE 1.7 64bit for Windows .为 Windows 安装JDK 64 bit 1.6 for Windows安装JRE 1.7 64bit for Windows

It worked in my case.它适用于我的情况。

I spent a little over an hour trying just about every option presented.我花了一个多小时尝试了几乎所有呈现的选项。 I eventually figured out that I had a lot of stale entries for software that I had uninstalled.我最终发现我有很多已卸载软件的陈旧条目。 I deleted all the registry nodes that had any stale data (pointed to the wrong directory).我删除了所有有任何陈旧数据的注册表节点(指向错误的目录)。 This included the这包括

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\JavaSoft\Java Runtime Environment] [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\JavaSoft\Java 运行时环境]

and

[HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment] [HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java 运行环境]

entries as a JRE included in the JDK.条目作为 JRE 包含在 JDK 中。

I also got rid of all the JAVA entries in my environmental variables.我还删除了环境变量中的所有 JAVA 条目。 I guess I blame it on bad uninstallers that do not clean up after themselves.我想我将其归咎于糟糕的卸载程序,它们不会自行清理。

4 Different Solutions: 4 种不同的解决方案:

1) If you get above screen, just click BACK button and from previous screen click NEXT button. 1)如果您到达上面的屏幕,只需单击BACK按钮,然后从上一个屏幕单击NEXT按钮。 Actually silly, but sounds good.其实很傻,但听起来不错。

2) Download SDK Manager .zip format instead of .exe and then try to install. 2)下载 SDK Manager .zip格式而不是.exe然后尝试安装。 It's all so silly, but work like a charm.这一切都很愚蠢,但工作起来很有魅力。

3) If you installed 64 bit JDK means, just uninstall that and install 32-bit JDK. 3)如果你安装了64 位JDK,只需卸载它并安装 32 位 JDK。

4) You have to change that as following, 4)你必须改变它如下,

JAVA_HOME=C:/Program Files/Java/jdk1.8.0_11
JRE_HOME=C:/Program Files/Java/jre8
Path=%JAVA_HOME%;C:…

There is too many ways for doing it:有太多方法可以做到这一点:

Way number one方式一

If Java is installed perfectly in your machine, then please close the installer and try to reinstall it.如果Java在您的机器上安装完美,那么请关闭安装程序并尝试重新安装。

When you open it for the second time, it will find JAVA.第二次打开,会发现JAVA。

Way number 2方式 2

Set up an environment variable like this-像这样设置环境变量-

Environment variables for java installation java安装的环境变量

And then try again.然后再试一次。

It should work:)它应该工作:)

It is bug in the Android installer.这是 Android 安装程序中的错误。 Download the latest installer and try it.下载最新的安装程序并尝试一下。 Then it will work.然后它会起作用。

In my case problem was in JAVA_TOOL_OPTIONS environment variable.在我的例子中,问题出在 JAVA_TOOL_OPTIONS 环境变量中。 Nothing helps me until I removed it.在我删除它之前没有任何帮助。 Hope it help someone!希望它能帮助别人!

My problem was that i run studio.exe instead of studio64.exe.我的问题是我运行的是 studio.exe 而不是 studio64.exe。 I'm running Windows 8 64bits我正在运行 Windows 8 64 位

For Wine users:... For reasons having to do with "unimplemented" (as in: the "find" command and the "/D" switch to "copy"), it appears that you have to cheat a bit more to get Android SDK to see JDK in Wine.对于 Wine 用户:... 由于与“未实现”有关的原因(如:“查找”命令和“/D”切换到“复制”),看来您必须多作弊才能获得Android SDK 查看 Wine 中的 JDK。

However, I have passed the hurdles and am (I suppose) obliged to share something (anything) that worked:但是,我已经克服了障碍并且(我想)有义务分享一些有用的东西(任何东西):

  1. What is responsible for finding Java is the script "tools/lib/find_java.bat".负责查找 Java 的是脚本“tools/lib/find_java.bat”。 In the beginning of that file, add:在该文件的开头,添加:

    set java_exe=%JAVA_HOME%/bin/java.exe goto:EOF设置 java_exe=%JAVA_HOME%/bin/java.exe goto:EOF

    1. To circumvent the "copy /D not implemented" issue, in "tools/android.bat" comment out (with "rem") the lines from just after为了规避“copy /D not implemented”问题,在“tools/android.bat”中注释掉(使用“rem”)紧接着的行

    :MkTempCopy :MkTempCopy

to just before就在之前

:EndTempCopy

You should now (if you've set JAVA_HOME) be able to run android.bat and install the SDK parts you need.您现在应该(如果您设置了 JAVA_HOME)能够运行 android.bat 并安装您需要的 SDK 部分。

Windows 8 running the x64 SDK. Windows 8 运行 x64 SDK。

  1. Download the latest JDK from here: Oracle JDK从这里下载最新的 JDK: Oracle JDK
  2. Once downloaded and extracted go into the JDK file at C:\Program Files\Java\jdk1.7.0_80\bin and double click on the java Application file (it's the only one called just java ).下载 go 并将其解压缩到位于 C:\Program Files\Java\jdk1.7.0_80\bin 的 JDK 文件中,然后双击 java 应用程序文件(这是唯一一个名为java的应用程序文件)。 This will briefly open the command line.这将短暂打开命令行。
  3. Begin the process of installing Android Studio again, from scratch.再次从头开始安装 Android Studio。 It should automatically detect the SDK now.它现在应该会自动检测到 SDK。

For whatever reason Android Studio wouldn't detect it no matter what I put in manually or searched using the browse option.无论出于何种原因 Android 无论我手动输入什么或使用浏览选项搜索,Studio 都检测不到它。

Pressing back would not work.按回去是行不通的。

Reporting the error would not work.报告错误是行不通的。

Adding JAVA_HOME or other suggestions to the C:... would not work.将 JAVA_HOME 或其他建议添加到 C:... 将不起作用。

It was only beginning the installation of Android Studio again after running the java file that it worked.在运行 java 文件,它才再次开始安装 Android Studio。

I have the jdk installed on my D: drive.我的 D: 驱动器上安装了 jdk。 None of the other answers worked for me.其他答案都不适合我。 I got it to install by creating a symbolic link from the C: drive to the installed location:我通过创建从 C: 驱动器到安装位置的符号链接来安装它:

    c:
    cd "Program Files"
    mklink /d Java "d:\Program Files\Java"  

Note that the jdk (and jre) install directories are subdirectories of "Java" so upgrading is not a problem even though the name changes with the release.请注意,jdk(和 jre)安装目录是“Java”的子目录,所以升级不是问题,即使名称随着版本的变化而变化。

I add the following in the users Environment Variable( Windows 10)我在用户环境变量中添加以下内容(Windows 10)

JAVA_HOME=C:/Program Files/Java/jdk1.8.0_11
JRE_HOME=C:/Program Files/Java/jre8
Path=%JAVA_HOME%;C:...

And then cancel the current installation of Android Studio and start again.然后取消当前安装的Android Studio,重新启动。 It worked fine this time for me.这次对我来说效果很好。 No JDK error.没有 JDK 错误。

While this question has already been answered.虽然这个问题已经回答了。 Here is what exact steps you need to do when you are setting up for development.以下是设置开发时需要执行的具体步骤。 In general anything related to Java Development.一般来说,任何与 Java 开发相关的事情。

Setting Up Java设置 Java

Make sure you are using latest jdk url确保您使用的是最新的 jdk url

curl -L -O -H "Cookie: oraclelicense=accept-securebackup-cookie" -k "http://download.oracle.com/otn-pub/java/jdk/8u60-b27/jdk-8u60-linux-x64.tar.gz"
sudo update-alternatives --install "/usr/bin/java" "java" "/usr/local/jdk1.7.0_67/bin/java" 1
sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/local/jdk1.7.0_67/bin/javac" 1
sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/local/jdk1.7.0_67/bin/javaws" 1
sudo update-alternatives --config java
sudo update-alternatives --config javac
sudo update-alternatives --config javaws

Setting up your system in this case ubuntu/mac在这种情况下设置你的系统 ubuntu/mac

export ANDROID_HOME=/home/ashish/android-sdks
export ANDROID_SDK=/home/ashish/android-sdks
export JAVA_HOME=/usr/local/jdk1.8.0_45
export JDK_HOME=/usr/local/jdk1.8.0_45/
export JRE_HOME=/usr/local/jdk1.8.0_45/jre
export PATH=$PATH:$ANT_HOME/bin:$JAVA_HOME/bin:$JRE_HOME/bin:$ANDROID_HOME/platform-tools:$ANDROID_HOME/tools

this contents needs to appear in .profile in ubuntu or .bash_profile in mac in home folder we can go there using cd ~此内容需要出现在 ubuntu 中的.profile或 mac 主文件夹中的.bash_profile中我们可以 go 那里使用cd ~

If the Android SDK installation is not able to find the JDK, it may be because the JDK is not installed on your system or it may not be located in the expected location.如果 Android SDK 安装找不到 JDK,可能是因为 JDK 没有安装在您的系统上或者它可能不在预期的位置。

To fix this issue, you will need to install the JDK if it is not already installed, and then ensure that it is located in the correct location.要解决此问题,您需要安装 JDK(如果尚未安装),然后确保它位于正确的位置。

To check if JDK is installed or not, open command prompt and type "java -version", if JDK is installed it will show the version of JDK otherwise it will show "java is not recognized as an internal or external command"要检查是否安装了 JDK,请打开命令提示符并键入“java -version”,如果安装了 JDK,它将显示 JDK 的版本,否则将显示“java 未被识别为内部或外部命令”

Once you have installed JDK, you may need to update the system environment variable JAVA_HOME to point to the location of the JDK.安装 JDK 后,您可能需要更新系统环境变量 JAVA_HOME 以指向 JDK 的位置。

You can also check the android studio settings.您还可以检查 android 工作室设置。 Go to File > Settings > Appearance & Behavior > System Settings > Android SDK > SDK Platforms. Go 到文件 > 设置 > 外观和行为 > 系统设置 > Android SDK > SDK 平台。 Here, you can check whether JDK installed or not.在这里,您可以检查是否安装了 JDK。

After that, you should be able to install the Android SDK without any issues.之后,您应该可以毫无问题地安装 Android SDK。

Here are the steps to change the system environment variable JAVA_HOME in Windows:下面是修改Windows中系统环境变量JAVA_HOME的步骤:

  1. Press the Windows key + R to open the Run dialog box.按Windows键+R打开运行对话框。
  2. Type "sysdm.cpl" and press Enter to open the System Properties window.键入“sysdm.cpl”并按回车键打开系统属性 window。
  3. Click on the Advanced tab, then click on the Environment Variables button.单击“高级”选项卡,然后单击“环境变量”按钮。
  4. In the System variables section, scroll down and find the JAVA_HOME variable.在系统变量部分,向下滚动并找到 JAVA_HOME 变量。 If it does not exist, click on the New button to create it.如果它不存在,请单击“新建”按钮来创建它。
  5. In the Variable name field, type "JAVA_HOME" (without quotes).在变量名称字段中,键入“JAVA_HOME”(不带引号)。 In the Variable value field, enter the path to the JDK installation directory (eg, "C:\Program Files\Java\jdk1.8.0_241").在变量值字段中,输入 JDK 安装目录的路径(例如,“C:\Program Files\Java\jdk1.8.0_241”)。
  6. Click OK to close the Environment Variables window, then click OK again to close the System Properties window.点击OK关闭Environment Variables window,然后再次点击OK关闭System Properties window。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM