简体   繁体   English

Android SDK Manager拒绝打开

[英]Android SDK Manager refusing to open

The cmd flashes but then goes away. 该cmd闪烁,但随后消失。 I've edited the following to android.bat 我已将以下内容编辑为android.bat

set java_exe="C:\Program Files (x86)\Java\jre7\bin\java.exe"
set javaw_exe="C:\Program Files (x86)\Java\jdk1.7.0_51\bin\java.exe"
set jar_path=lib\sdkmanager.jar;lib\swtmenubar.jar
rem Set SWT.Jar path based on current architecture (x86 or x86_64)
set swt_path=lib\x86_64

I've tried running as administrator. 我尝试以管理员身份运行。 I've set the JAVA_HOME path 我已经设置了JAVA_HOME路径

currently using SDK version 1.7.0_51 and jre7 当前使用SDK版本1.7.0_51和jre7

I Run my Android.bat in cmd and get this output. 我在cmd中运行我的Android.bat并获取此输出。

C:\>C:\adt-bundle-windows-x86_64-20130522\sdk\tools\android.bat
Usage: java [-options] class [args...]
           (to execute a class)
   or  java [-options] -jar jarfile [args...]
           (to execute a jar file)
where options include:
-d32          use a 32-bit data model if available
-d64          use a 64-bit data model if available
-client       to select the "client" VM
-server       to select the "server" VM
-hotspot      is a synonym for the "client" VM  [deprecated]
              The default VM is client.

-cp <class search path of directories and zip/jar files>
-classpath <class search path of directories and zip/jar files>
              A ; separated list of directories, JAR archives,
              and ZIP archives to search for class files.
-D<name>=<value>
              set a system property
-verbose:[class|gc|jni]
              enable verbose output
-version      print product version and exit
-version:<value>
              require the specified version to run
-showversion  print product version and continue
-jre-restrict-search | -no-jre-restrict-search
              include/exclude user private JREs in the version search
-? -help      print this help message
-X            print help on non-standard options
-ea[:<packagename>...|:<classname>]
-enableassertions[:<packagename>...|:<classname>]
              enable assertions with specified granularity
-da[:<packagename>...|:<classname>]
-disableassertions[:<packagename>...|:<classname>]
              disable assertions with specified granularity
-esa | -enablesystemassertions
              enable system assertions
-dsa | -disablesystemassertions
              disable system assertions
-agentlib:<libname>[=<options>]
              load native agent library <libname>, e.g. -agentlib:hprof
              see also, -agentlib:jdwp=help and -agentlib:hprof=help
-agentpath:<pathname>[=<options>]
              load native agent library by full pathname
-javaagent:<jarpath>[=<options>]
              load Java programming language agent, see java.lang.instrument

-splash:<imagepath>
              show splash screen with specified image

See http://www.oracle.com/technetwork/java/javase/documentation/index.html for m ore details. 有关详细信息,请参见http://www.oracle.com/technetwork/java/javase/documentation/index.html

I had this same problem and I found that none of the "set" commands in beginning of the batch file worked correctly. 我遇到了同样的问题,并且发现批处理文件开头的所有“设置”命令均无法正常工作。

prog is set to ~f0. prog设置为〜f0。
work_dir is empty work_dir为空
cd /d ~dp0 results in an error "The filename, directory name, or volume label syntax is incorrect." cd / d〜dp0导致错误“文件名,目录名或卷标签语法不正确。”

Android.bat requires command extensions enabled in order to run correctly. Android.bat需要启用命令扩展名才能正常运行。

Edit this line in the original android.bat 在原始android.bat中编辑此行
from... 从...
setlocal setlocal
to... 至...
setlocal enableExtensions setlocal enableExtensions

This should set all the environment variables correctly so that they don't need to be hard coded. 这应该正确设置所有环境变量,以便不需要对其进行硬编码。

You can also enable command extensions in the registry. 您还可以在注册表中启用命令扩展名。 Reboot after making this change. 进行此更改后,重新启动。 HKEY_CURRENT_USER\\Software\\Microsoft\\Command Processor\\EnableExtensions = 1 HKEY_CURRENT_USER \\ Software \\ Microsoft \\ Command Processor \\ EnableExtensions = 1

It's too late but may help for anyone who still can't fix this issue, follow these step and it help for me after a long time with all ways above not effect, no need to have JAVA_HOME system variable or edit android.bat 为时已晚,但对于仍无法解决此问题的任何人可能会有所帮助,请按照以下步骤操作,经过很长时间上述所有步骤均对我没有帮助,无需JAVA_HOME系统变量或编辑android.bat

  1. Download Android Studio within Android SDK, Java JDK 64 bits and Java JRE x86 在Android SDK,Java JDK 64位和Java JRE x86中下载Android Studio

  2. Install Java JRE first, then install Java JDK 64 bits, and the Android Studio last. 首先安装Java JRE,然后再安装Java JDK 64位,最后安装Android Studio。

  3. Now you start Android Studio first (64 bits version) it require to have JAVA_HOME setting to run JVM, just copy the jdk.xxx(version) folder (my PC: jdk1.8.0_25 from "C:\\Program Files\\Java\\")folder to Android Studio folder and rename that folder (in Android Studio) to "jre" (jdk1.8.0_25 -> jre). 现在,您首先启动Android Studio(64位版本),它需要具有JAVA_HOME设置才能运行JVM,只需从“ C:\\ Program Files \\ Java \\”复制jdk.xxx(version)文件夹(我的PC:jdk1.8.0_25)即可。 )文件夹到Android Studio文件夹,然后将该文件夹(在Android Studio中)重命名为“ jre”(jdk1.8.0_25-> jre)。

  4. Now it work for me to open Android SDK Manager from anywhere, if you want to use eclipse (not official now) just copy the java jre.xxx(version) x86 folder (from where you install before) to Eclipse and rename to "jre". 现在,它可以从任何地方打开Android SDK Manager,如果您想使用eclipse(现在不正式),只需将java jre.xxx(version)x86文件夹(从之前安装的位置)复制到Eclipse,然后重命名为“ jre ”。 After coping, choose the Android SDK path in Eclipse to use, It works for both Android Studio and Eclipse. 应对之后,在Eclipse中选择要使用的Android SDK路径。它适用于Android Studio和Eclipse。

  5. Mind your antivirus if it still refusing you (remove antivirus and install after you sure it not cause problem)! 请注意防病毒软件(如果它仍然拒绝您)(在确保它不会引起问题之后,请删除并安装防病毒软件)!

Hope it help for you. 希望对您有帮助。

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

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