SDK Manager failed to start

Source: Internet
Author: User

First cmd switch to Android-sdk-windows\tools\lib, find Find_java.bat

Turn on Echo: rem @echo off, then run Find_java.bat, if the output set java_exe= does not match the JDK installation path, you need to check the environment variables Java_ Java.exe is set correctly in home and path, and its logic is Android/platform/sdk/find_java/src/source/find_java_ The function Findjavainenvpath in lib.cpp:

View Code//Search Java.exe in the environmentintFindjavainenvpath (CPath *outjavapath, bool isjdk,intMinVersion) {setlasterror (0);Const Char* Envpath = getenv ("Java_home");if(Envpath! = NULL) {CPath P (envpath);if(!isjdk | | isjdkpath (P)) {intv = 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.                returnV }        }    }intcurrversion = 0; Envpath = getenv ("PATH");if(!envpath)returnCurrversion;//Otherwise look at the entries on the current path.    //If We find more than one, keep the one with the highest version.carray<cstring> *paths = CString (Envpath). Split (';'); for(inti = 0; I < paths->size (); i++) {CPath P ((*paths) [I].cstr ());if(Isjdk &&!isjdkpath (p)) {Continue; }intv = 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;returnCurrversion;}

It can be seen that the logic is to look for java_home in the environment variable, and if not, to find the highest version of Java.exe in Path, of course, the minimum version of Java.exe is 6.1.

If Java.exe is set correctly in the environment variable, check whether the batch find_java.bat is wrong, because the SDK Manager.exe source android/platform/sdk/sdklauncher/src/source/ SDKLAUNCHER.C shows that it is called Android-sdk-windows\tools\android.bat

View CodeintSdk_launcher () {intresult = 0;    Startupinfo startup;    Process_information pinfo; CHAR Program_dir[max_path];intRET, 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.batret = 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 are located in the SDK folder            //and needs to access Sdk\tools\android.batret = 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");returnResult;}

SDK Manager failed to start

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.