简体   繁体   English

无法在Android Studio中打开SDK管理器

[英]Unable to open sdk manager in android studio

I am unable to open android sdk manager in android studio i recently downloaded this.when i click this it shows me a pop up : Cannot launch SDK manager. 我无法在android studio中打开android sdk管理器,我最近下载了this。当我单击此按钮时,它显示了一个弹出窗口:无法启动SDK管理器。 Output: 输出:

'"C:\\Users\\suraj\\AppData\\Local\\Android\\ANDROI~2\\sdk\\tools\\lib\\find_java.exe" -s' is not recognized as an internal or external command, operable program or batch file. 无法将““ C:\\ Users \\ suraj \\ AppData \\ Local \\ Android \\ ANDROI〜2 \\ sdk \\ tools \\ lib \\ find_java.exe” -s识别为内部或外部命令,可操作程序或批处理文件。

ERROR: No suitable Java found. 错误:找不到合适的Java。 In order to properly use the Android Developer Tools, you need a suitable version of Java JDK installed on your system. 为了正确使用Android Developer Tools,您需要在系统上安装合适版本的Java JDK。 We recommend that you install the JDK version of JavaSE, available here: http://www.oracle.com/technetwork/java/javase/downloads 我们建议您安装JavaSE的JDK版本,可从以下位置获取: http : //www.oracle.com/technetwork/java/javase/downloads

If you already have Java installed, you can define the JAVA_HOME environment variable in Control Panel / System / Avanced System Settings to point to the JDK folder. 如果已经安装了Java,则可以在“控制面板” /“系统” /“高级系统设置”中定义JAVA_HOME环境变量以指向JDK文件夹。

You can find the complete Android SDK requirements here: http://developer.android.com/sdk/requirements.html 您可以在此处找到完整的Android SDK要求: http : //developer.android.com/sdk/requirements.html

so can anyone help me .!!! 谁能帮我。!!! how to overcome this problem I am using windows 7 os 如何克服这个问题,我正在使用Windows 7 OS

Make sure your environment vars JDK_HOME and JAVA_HOME are set properly to the installed JDK package. 确保将环境变量JDK_HOME和JAVA_HOME正确设置为已安装的JDK软件包。 AS requires oracle JDK, try to use the latest for your system. AS需要oracle JDK,请尝试为您的系统使用最新版本。

Edit: Check if "java" and "javac" are known as commands in console 编辑:检查“ java”和“ javac”是否在控制台中称为命令

Also check if the path to JDK is set in project properties: Right click on project folder -> Open Module settings 还要检查是否在项目属性中设置了JDK的路径:右键单击项目文件夹->打开模块设置

Finally try to use / for the envi path instead of \\ which usually is used in windows 最后,尝试将/用作envi路径,而不是Windows中通常使用的\\

I have found a problem with the Android Studio studio.bat file and here it is 我发现Android Studio studio.bat文件有问题,这是

    ::------------------------------------------------------
    :: Locate a JDK installation directory which will be used to run the IDE.
    :: Try (in order): ANDROID_STUDIO_JDK, ..\jre, JDK_HOME, JAVA_HOME.
    :: ---------------------------------------------------------------------
    IF EXIST "%ANDROID_STUDIO_JDK%" SET JDK=%ANDROID_STUDIO_JDK%
    IF NOT "%JDK%" == "" GOTO jdk
    IF EXIST "%~dp0\..\jre" SET JDK=%~dp0\..\jre
    IF NOT "%JDK%" == "" GOTO jdk
    IF EXIST "%JDK_HOME%" SET JDK=%JDK_HOME%
    IF NOT "%JDK%" == "" GOTO jdk
    IF EXIST "%JAVA_HOME%" SET JDK=%JAVA_HOME%
    IF "%JDK%" == "" GOTO error

Do you get the problem in the last 2 lines of code? 您是否在最后两行代码中遇到问题?
It seems that if your environmental variable is %JAVA_HOME% the batch file will GOTO error and an error message will be displayed and that's it NO ANDROID STUDIO FOR YOU, even though %JAVA_HOME% contains a valid path but if the environmental variable is something like %ANDROID_STUDIO_JDK% like mine is because I created it myself then it will work 看来,如果您的环境变量是%JAVA_HOME%,则批处理文件将转到GOTO错误并显示一条错误消息,即使%JAVA_HOME%包含有效路径,但对于您来说,它不是ANDROID STUDIO,但是如果环境变量类似于%ANDROID_STUDIO_JDK%和我一样,是因为我自己创建了它,然后它将起作用


PROPOSED SOLUTIONS 建议的解决方案

(1) Edit the batch file Where you see this IF EXIST "%JAVA_HOME%" SET JDK=%JAVA_HOME% IF "%JDK%" == "" GOTO error (1)编辑批处理文件看到此IF EXIST "%JAVA_HOME%" SET JDK=%JAVA_HOME% IF "%JDK%" == "" GOTO error
Change it to this 改成这个
IF EXIST "%JAVA_HOME%" SET JDK=%JAVA_HOME% IF NOT "%JDK%" == "" GOTO jdk IF "%JDK%" == "" GOTO error
(2) Create an environmental variable named %ANDROID_STUDIO_JDK% as shown here https://kb.wisc.edu/cae/page.php?id=24500 (2)创建一个名为%ANDROID_STUDIO_JDK%的环境变量,如此处所示https://kb.wisc.edu/cae/page.php?id=24500

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

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