The Android 5.0 SDK cannot open the companion tool solution

Source: Internet
Author: User

As a daily job, you often use tools such as the Hierarchyviewer, Uiautomatorviewer, DDMS, and so on that come with the Android SDK, which happens to be on the Android L release and updates the Android Stutio 1.0,SDK is also accompanied by a significant update, including Uiautomatorviewer and other tools have a new version. So yesterday a new version came up, installed, and then reset the environment variables, and so a series of things, and then open Uiautomatorviewer, unexpectedly prompted error:

'-V ' is not an internal or external command and is not a running program
or batch files.
Invalid path
ERROR:SWT folder "does not exist.
"Please set ANDROID_SWT to" to "the" folder containing Swt.jar for your platform.

Is there a problem with my environmental configuration? Google a bit, found that most of the answer is to set the ANDROID_SWT environment variables, or the JDK to move to the path of the first and so strange way, so try to give up for half a day, or at ease debugging and debugging to see what happened.

The first line of the Uiautomatorviewer.bat is @echo off with a colon ":" commented out, then shipped a new one, see output:

C:usersxxx.xxx>rem Copyright (C) The Android Open Source Project ... C:usersxxx.xxxappdatalocalandroidsdktools>rem Check We have a valid Java.exe in the path. C:usersxxx.xxxappdatalocalandroidsdktools>set java_exe= C:usersxxx.xxxappdatalocalandroidsdktools>call Libfind_java.bat SWT folder ' does not exist. "Please set ANDROID_SWT to" to "the" folder containing Swt.jar for your platform.

C:usersxxx.xxx>rem Copyright (C) The Android Open Source Project
......
C:usersxxx.xxxappdatalocalandroidsdktools>rem Check We have a valid Java.exe in the path.
C:usersxxx.xxxappdatalocalandroidsdktools>set java_exe=
C:usersxxx.xxxappdatalocalandroidsdktools>call Libfind_java.bat
SWT folder ' does not exist.
"Please set ANDROID_SWT to" to "the" folder containing Swt.jar for your platform.


Run to call Libfind_java.bat this line of problems bird ~ ~

Then touch the Find_java.bat, comment out the @echo off of the first line, and look at the output:

... for/f "delims="%a in (' C:usersxxx.xxxappdatalocalandroidsdktoolslibfind_java32. exe ') do set java_exe=%a ... ....

......
for/f "delims="%a in ("" C:usersxxx.xxxappdatalocalandroidsdktoolslibfind_java32. exe "-S") do set java_exe=%a
......


Find_java32. exe is what ghost ...

Open Find_java.bat's code, you can see 27 lines here

for/f "delims="%%a in (' "%~dps0find_java%arch_ext%.exe"-s-w ") do set javaw_exe=%%a

for/f "delims="%%a in (' "%~dps0find_java%arch_ext%.exe"-s-w ") do set javaw_exe=%%a


Is the Buddha, turn up to the Arch_ext:

find/i "x86" > NUL && set arch_ext=32 | | Set arch_ext=64

find/i "x86" > NUL && set arch_ext=32 | | Set arch_ext=64


The space should be here, may be the engineers have written more Java, bat praying holding hands also scoop, the space before and after removing try ~ ~

find/i "x86" > NUL && Set arch_ext=32| | Set arch_ext=64

find/i "x86" > NUL && Set arch_ext=32| | Set arch_ext=64


Turn off the cmd, reopen, the new version of the uiautomatorviewer appeared birds ~ ~ Then test the other need to use the call Libfind_java.bat tools (tools in almost all use it), there is no problem.

Related Article

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.