SDK Manager无法启动
首先cmd切换到android-sdk-windows\tools\lib,找到find_java.bat
打开回显:rem @echo off,再运行find_java.bat,若输出的set java_exe=同jdk安装路径不符,则需要检查环境变量JAVA_HOME和PATH中java.exe是否设置正确,其逻辑在于android/platform/sdk/find_java/src/source/find_java_lib.cpp中的函数findJavaInEnvPath:
// Search java.exe in the environment
int findJavaInEnvPath(CPath *outJavaPath, bool isJdk, int minVersion) {
SetLastError(0); const char* envPath = getenv("JAVA_HOME");
if (envPath != NULL) {
CPath p(envPath); if (!isJdk || isJdkPath(p)) {
int v = checkBinPath(&p);
if (v >= minVersion) {
if (gIsDebug) {
fprintf(stderr, "Java %d found via JAVA_HOME: %s\n", v, p.cstr());
}
*outJavaPath = p;
// As an optimization for runtime, if we find a suitable java
// version in JAVA_HOME we won't waste time looking at the PATH.
return v;
}
}
} int currVersion = 0;
envPath = getenv("PATH");
if (!envPath) return currVersion; // Otherwise look at the entries in the current path.
// If we find more than one, keep the one with the highest version. CArray<CString> *paths = CString(envPath).split(';');
for(int i = 0; i < paths->size(); i++) {
CPath p((*paths)[i].cstr()); if (isJdk && !isJdkPath(p)) {
continue;
} int v = checkPath(&p);
if (v >= minVersion && v > currVersion) {
if (gIsDebug) {
fprintf(stderr, "Java %d found via env PATH: %s\n", v, p.cstr());
} currVersion = v;
*outJavaPath = p;
}
} delete paths;
return currVersion;
}
可看到其逻辑是在环境变量中先查找JAVA_HOME,若没有则再查找PATH中最高版本的java.exe,当然java.exe的版本最小为6.1。
若环境变量中java.exe设置无误,则检查批处理find_java.bat是否有误,这是因为SDK Manager.exe源码android/platform/sdk/sdklauncher/src/source/sdklauncher.c显示其是调用android-sdk-windows\tools\android.bat
int sdk_launcher() {
int result = 0;
STARTUPINFO startup;
PROCESS_INFORMATION pinfo;
CHAR program_dir[MAX_PATH];
int ret, pos;
ZeroMemory(&pinfo, sizeof(pinfo));
ZeroMemory(&startup, sizeof(startup));
startup.cb = sizeof(startup);
startup.dwFlags = STARTF_USESHOWWINDOW;
startup.wShowWindow = SW_HIDE|SW_MINIMIZE;
/* get path of current program, to switch dirs here when executing the command. */
ret = GetModuleFileName(NULL, program_dir, sizeof(program_dir));
if (ret == 0) {
display_error("Failed to get program's filename:");
result = 1;
} else {
/* Remove the last segment to keep only the directory. */
pos = ret - 1;
while (pos > 0 && program_dir[pos] != '\\') {
--pos;
}
program_dir[pos] = 0;
}
if (!result) {
dprintf("Program dir: %s\n", program_dir);
// SDK Manager.exe is installed by the Windows Installer just below
// the tools directory and needs to access tools\android.bat
ret = CreateProcess(
NULL, /* program path */
"tools\\android.bat sdk", /* command-line */
NULL, /* process handle is not inheritable */
NULL, /* thread handle is not inheritable */
TRUE, /* yes, inherit some handles */
CREATE_NO_WINDOW, /* we don't want a console */
NULL, /* use parent's environment block */
program_dir, /* use parent's starting directory */
&startup, /* startup info, i.e. std handles */
&pinfo);
if (!ret) {
dprintf("CreateProcess returned %d\n", ret);
// In the ADT bundle, SDK Manager.exe is located in the sdk folder
// and needs to access sdk\tools\android.bat
ret = CreateProcess(
NULL, /* program path */
"sdk\\tools\\android.bat sdk", /* command-line */
NULL, /* process handle is not inheritable */
NULL, /* thread handle is not inheritable */
TRUE, /* yes, inherit some handles */
CREATE_NO_WINDOW, /* we don't want a console */
NULL, /* use parent's environment block */
program_dir, /* use parent's starting directory */
&startup, /* startup info, i.e. std handles */
&pinfo);
}
dprintf("CreateProcess returned %d\n", ret);
if (!ret) {
display_error("Failed to execute tools\\android.bat:");
result = 1;
}
}
dprintf("Cleanup.\n");
return result;
}
SDK Manager无法启动的更多相关文章
- Android 的 SDK Manager 无法启动 闪退解决方法
[故障描述] 做 Android 开发就要下载 Android SDK,其中的 SDK Manager.exe 无法启动,一闪而过. 尝试重装 JDK.重新从官网下载 Android SDK.添加环境 ...
- Android SDK 的SDK Manager打不开,一闪就退,无法启动,解决方法
前一分钟还能打开,在eclipse中点了更新SDK后就启不动了 看下目录的修改时间,tool目录已经是今天的时间, 在升级过程中修改过了,给他改名 tempToolsDir 改名为tool 再尝试下启 ...
- ADT SDK Manager启动时一闪而过
原因为使用了Android Studio的绿色JRE,必须要安装安装版JDK或者JRE,绿色版JRE放在ADT目录虽然能启动ADT但是不能启动SDK Manager
- ubuntu 中启动SDK manager
Android SDK安装后,目录结构如下: root@localhost:/home/ranxf/Android/Sdk/android-sdk-linux# ll 总用量 drwxrwxr-x r ...
- 解决Android SDK Manager下载问题和android studio每次启动都要在fetching Android sdk compoment information
1.能解决国内访问Google服务器的困难启动 Android SDK Manager ,打开主界面,依次选择「Tools」.「Options...」,弹出『Android SDK Manager - ...
- linux===启动sdk manager下载配置sdk的时候报错的解决办法
当启动sdk manager下载配置sdk的时候,报错如下: botoo@botoo-virtual-machine:/opt/android-sdk-linux/tools$ sudo ./and ...
- Android Studio 1.5启动出现“SDK Manager: failed to install”问题的解决
问题描述 Android Studio 1.5是当前最新Android手机应用开发平台,下载bundle版安装后,启动Studio后出现“SDK Manager: failed to install” ...
- 安卓虚拟机启动后报错: 类似 SDK Manager] Error: Error parsing .....devices.xml 解决方案
昨天用android sdk manager 更新了android sdk, 我是在eclipse上面安装adt来开发android的, 而且我每次打开虚拟机的时候也报错.报错的信息都是一样的. ...
- [转]安卓虚拟机启动后报错: 类似 SDK Manager] Error: Error parsing .devices.xml 解决方案
昨天用android sdk manager 更新了android sdk, 我是在myeclipse上面安装adt来开发android的现在每次打开myeclipse都报错, 而且我每次打开虚拟机的 ...
随机推荐
- 在Android上模拟登录广工正方教务系统查询成绩
这是在博客园里开博以来写的第一篇博客. 因为之前看过很多人都有发过关于模拟登录正方软件获取数据的文章,自己觉得挺好玩的便也去动手一做,开始还以为挺难的,但实际做起来还蛮简单的,当然其中还有些小插曲. ...
- 【转自CSDN】深入 Microsoft.VisualBasic.Strings.StrConv 簡繁轉換
深入 Microsoft.VisualBasic.Strings.StrConv 簡繁轉換 昨天又遇到一個簡繁轉換的需求, 雖然這個問題以前已經處理過了, 但是以前是用自己建立的 b52gb 和 gb ...
- Java的split方法说明
相信大家都经常使用String 的split方法,但是大家有没有遇到下面的这种情况: 大家想想下面的代码执行结果是什么 public static void main(String[] args) { ...
- Powershell profile.ps1 cannot be loaded because its operation is blocked by software restriction policies
Powershell profile.ps1 cannot be loaded because its operation is blocked by software restriction pol ...
- 学习protobuf
一.认识Protobuf ref:http://blog.csdn.net/program_think/article/details/4229773摘要:1. protobuf是一个开源项目.2. ...
- 【工具篇】notepad++
一直都是使用notepad++来写程序,感觉比UE好用多了,没有UE那么重.前段时间网上还做了一个调查,notepad++在国外使用排行还是非常高的,在国内也是很流行.以下记录一些比较实用的技巧. 一 ...
- 【实习记】2014-08-15文档太少看着源码用cgicc+stl库之模板谓词函数对象
总结1: 今天找到了昨天scanf的问题答案,scanf与printf一样的神奇而复杂,稍不留神,就会被坑.scanf函数在读入非空白符分割的多个字符串的解决方法是这个:/* 以 | 分割 * ...
- CSS鼠标点击式变化图片透明度
今天分享前端代码主题:jequery控制css图片透明度 很多时候在网站图片处理上需要实现一些辅助效果,比如鼠标在图片上滑动时或点击时改变图片颜色(变灰或者其他),其实一个简单的办法就是改变图片css ...
- Android Linux自带iptables配置IP访问规则
利用Linux自带iptables配置IP访问规则,即可做到防火墙效果
- #Leet Code# Binary Tree Max[待精简]
描述:递归调用,getMax返回 [节点值,经过节点左子节点的最大值,经过节点右节点的最大值],每次递归同时查看是否存在不经过节点的值大于max. 代码:待优化 def getLargeNode(se ...